fluentribbon / Fluent.Ribbon

WPF Ribbon control like in Office
http://fluentribbon.github.io
MIT License
2.48k stars 515 forks source link

The first item is highlighted when DropDown is opened by mouse interaction in DropDownButton and SplitButton #1170

Closed yordans closed 2 months ago

yordans commented 9 months ago

The first focusable item (MenuItem) in controls with dropdown (DropDownButton, SplitButton) is highlighted (focused) when the dropdown is opened. An item should be highlighted on user interaction, e.g. navigating with the keyboard.


Environment

batzen commented 9 months ago

Why do you think that's a bug? It's the same for a ComboBox. It's the same for SplitButton and DropDownButton in Office itself.

Aside from that, navigating by keyboard would not be possible if the first item wouldn't receive focus when opening as there would be no focus inside the controls popup.

yordans commented 9 months ago

DropDownButton and SplitButton do not highlight the first item on open in Microsoft Office and Windows File Explorer. So I think it is the correct behavior.

I think keyboard navigation is possible if a parent element of the ItemsPresenter is focusable and gets the focus on open.

batzen commented 9 months ago

DropDownButton and SplitButton do not highlight the first item on open in Microsoft Office and Windows File Explorer. So I think it is the correct behavior.

They do so when navigating by keyboard. And many other tools (VS Code, Rider, Windows settings etc.) also set focus inside the respective control when interacting by mouse.

I think keyboard navigation is possible if a parent element of the ItemsPresenter is focusable and gets the focus on open.

Setting focus on elements that have no user interaction should always be avoided.

To repeat: Why do you think that's a bug? Does it cause any issues, or do you just personally dislike the behavior? The default implementation of ComboBox in WPF also behaves the same.

yordans commented 9 months ago

I am sorry for not specifying that the issue relates to opening the dropdown by mouse interaction only. It seems to me like an incorrect behavior, since all the aforementioned applications do not highlight the first item when opening the dropdown by mouse.

yordans commented 9 months ago

Hello, @batzen, do you agree that it is better to not highlight the first item when opening dropdowns with the mouse? If not, should the issue be closed?

batzen commented 9 months ago

It seems to me like an incorrect behavior, since all the aforementioned applications do not highlight the first item when opening the dropdown by mouse.

As state by my comment, that's not true. They do highlight the first item when no item was previously selected and highlight the currently selected item when there was previously one selected. That's at least the case for ComboBox like controls. But also controls more like DropDownButton focus the first item, i just couldn't find examples for every application.

ComboBox behavior like in Ribbon: WPF, GitKraken, VS Code, Rider, Windows Settings, Word ComboBox behavior not like in Ribbon: Visual Studio (sometimes, depending on which ComboBox you use...) DropDown behavior like in Ribbon: Rider, Word (when using keyboard) DropDown behavior not like in Ribbon: Visual Studio, GitKraken, VS Code, Word (when using mouse)

Hello, @batzen, do you agree that it is better to not highlight the first item when opening dropdowns with the mouse? If not, should the issue be closed?

I am not sure if it should be changed. I personally often use a mix of keyboard and mouse navigation to operate programs. This works perfectly fine with the current ribbon implementation as i can open the popup by mouse and immediately navigate by using the keyboard. Doing the same in, for example, Word is also possible but there is no visible keyboard focus initially, so it's not immediately obvious that it works.