Bug? Can't tab out of ribbon.

Ribbon for WPF Forum

Posted 16 years ago by Kollen Glynn
Version: 3.5.0421
Avatar
We don't seem to be able to use the keyboard to tab out of the ribbon to other controls, the tab order just cycles within the ribbon. Is this a known issue?

Comments (3)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Actually that is by design. When controls in the Ribbon have focus, tabbing around stays in the Ribbon. This is the same in Office 2007.

You can press Esc at any time to return focus to the main focus scope.

Also you could potentially set a different KeyboardNavigation property value on Ribbon if you wanted to alter this behavior.


Actipro Software Support

Posted 16 years ago by Kollen Glynn
Avatar
There's something not quite right though. Hitting escape will take you back to the main focus scope but then hitting tab again will take you straight back in. It seems like escape should move the tab forward rather than back. I don't even understand why tab goes in the first place as IsTabStop is set to false on the ribbon.

We ran into another related problem where buttons become disabled if focus changes, setting FocusManager.IsFocusScope="False" seem to fix the problem but then hitting escape never gets the tab out. I understand this is related to command targeting but menus and toolbars don't seem to have this problem.

What's the best way to handle all this?
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I'm not seeing the Escape/Tab issue when I try in our demo. I set focus to the font drop-down and click Escape. Focus is back in the document. Then I press tab and it is consumed by the editor properly. If you are changing focus scopes then you could be causing this issue.

Anything that is a menu or toolbar should always be a focus scope. From the MSDN:
"A focus scope is a container element that keeps track of the FocusManager.FocusedElement within the its scope. By default, the Window class is a focus scope as are the Menu, ContextMenu, and ToolBar classes. An element which is a focus scope has IsFocusScope set to true."

So we have Ribbon as a focus scope since it more or less is a toolbar. This allows you to have focus set in the content area and for Ribbon to be able to have the commands in its button react to the current focused element in the content area.

But please note that you must keep focus within the content area or you could see some ribbon button disabling, for instance if your Window somehow gets focus and not the content inside of it.


Actipro Software Support

The latest build of this product (v24.1.3) was released 28 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.