fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Menu buttons: Clicking on a subMenuProp (dropdown in a command bar) and then pressing enter key, by default selects the first index and invoke its's click event.

Open AkshanshSrivastava03 opened this issue 9 years ago • 12 comments

Bug Report

Command Bar- Clicking on a subMenuProp (dropdown in a command bar) and then pressing enter key, by default selects the first index and invoke its's click event.

  • Package version(s): ^0.87.1
  • Browser and OS versions: NA

Describe the issue:

Repro steps: 1.) Click on the dropdown under command bar 2.) None of the child elements look selected acc to UI. (None of them are shadowed/greyed) 3.) Press enter. The first child element's click event is triggered even when it was not selected as per the UI.

Actual behavior:

First child is selected but not shown selected properly. //Click dropdown in Command bar (subMenuProps containing child items)

Expected behavior:

Either the first element should be shown as selected or pressing enter after clicking should not trigger first element's click event

If applicable, please provide a codepen repro:

AkshanshSrivastava03 avatar Jan 25 '17 08:01 AkshanshSrivastava03

This is a really interesting one. It is technically by design. When you click a menu, we set focus to the first item in the submenu, but we hide the focus rectangle until you press a keystroke. We do this for accessibility reasons; screen readers read out the menu item as things are focused.

What you're asking is; if mouse click, don't set focus on the first item. Instead, keep the focus on the first item. If enter is pressed, it would toggle the menu closed. If you press down arrow, it would focus the first item. This would address your issue but probably cause accessibility concerns.

But I also think the keyboarding path may be different. If you press enter to expand a command bar menu rather than clicking, I think you do want the focus to jump to the first menu item. Then you can hit enter twice to just execute the first menu item.

@cschlechty and @betrue-final-final do you have any thoughts here? After playing with some other menu systems, I think they follow the model I described above. However it could affect screen readers if the user clicks on a menu expanding it, it would not read the first item until they down arrow.

dzearing avatar Jan 25 '17 16:01 dzearing

I've discussed this with accessibility and design; I think we will try to address this to perfect the interaction model. We will only move focus on keyboarding; on mouse clicks, we will maintain focus at the command clicked.

dzearing avatar Jan 26 '17 01:01 dzearing

I'd be inclined to follow the pattern Windows uses. Let's not reinvent menu interactions.

cschlechty avatar Jan 26 '17 01:01 cschlechty

I thought that this was a pretty intentional choice. It shouldn't be that hard to change it so that it focuses the list rather than the first item.

joschect avatar Jan 29 '17 21:01 joschect

As far as I understand it correctly, you are trying to bring the focus on the list rather than the first time in the scenario i have mentioned. Can we get an ETA for this?

AkshanshSrivastava03 avatar Feb 01 '17 09:02 AkshanshSrivastava03

@dzearing Hi, any update on this? I see an attached bug getting closed. Is this related to that one?

AkshanshSrivastava03 avatar Feb 07 '17 05:02 AkshanshSrivastava03

We should keep focus on command bar and only move focus to the menu on down arrow.

gokunymbus avatar Jan 11 '18 20:01 gokunymbus

@dzearing is this resolved?

betrue-final-final avatar Mar 14 '18 15:03 betrue-final-final

We are shipping a refactored command bar in 6.0. We can test it in that one, but I haven't touched this code in a while.

dzearing avatar Apr 11 '18 02:04 dzearing

This issue has been automatically marked as stale because it has not activity for 30 days. It will be closed if no further activity occurs within 14 days of this comment. Thank you for your contributions to Fabric React! Why am I receiving this notification?

stale[bot] avatar Jun 10 '18 03:06 stale[bot]

@dzearing Was this addressed in 6.0? If so, can we close?

michaelangotti avatar Jun 12 '18 22:06 michaelangotti

this has been fixed in the 6.0 version. Clicking on a dropdown doesn't set the first item as infocus. This is consistent with windows UI.

image

micahgodbolt avatar Jun 18 '18 21:06 micahgodbolt