-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
The MenuBar widget takes a MenuController to override the default one.
SubmenuButton does not.
Without that, it does not appear to open a submenu programmatically.
Use case
On web on Mac, the menu cannot be accessed with the Alt key because Mac does not work this way.
Ctrl-F2 is the shortcut used on mac to access the system menu, but that does not give us access to the menu being rendered inside the Chrome page.
Google Docs uses the key combination Option+/ to open the Docs menu.
A menu needs to be reachable with the keyboard for accessibility issues.
This could be done through a separate shortcut action if the MenuController could be overridden on the SubmenuButton.
The MenuController for the MenuBar is useless as the top menu bar is always considered open.
Proposal
add a MenuController? parameter to SubmenuButton, and use it instead of the one created in the state object.
In addition, and that's optional, SubmenuButton should wrap MenuAnchor.onOpen to set the focus to the focus node an that next frame, similar to what is done in "toggleShowMenu", so that the external widget can simply call "open" on the controller to simulate the menu element being clicked.