Skip to content

Cannot open a Submenu from another widget #124988

@saintmac-google

Description

@saintmac-google

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: desktopRunning on desktopcustomer: quake (g3)frameworkflutter/packages/flutter repository. See also f: labels.platform-macBuilding on or for macOS specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions