Skip to content

[material/menu_anchor.dart] Improve MenuAnchor focus traversal and accessibility.#177159

Closed
davidhicks980 wants to merge 0 commit into
flutter:masterfrom
davidhicks980:menu_anchor_focus
Closed

[material/menu_anchor.dart] Improve MenuAnchor focus traversal and accessibility.#177159
davidhicks980 wants to merge 0 commit into
flutter:masterfrom
davidhicks980:menu_anchor_focus

Conversation

@davidhicks980

@davidhicks980 davidhicks980 commented Oct 17, 2025

Copy link
Copy Markdown
Contributor

Fixes #119532

Also, adds a few features from https://www.w3.org/WAI/ARIA/apg/patterns/menubar/:

  • Adds two actions to vertically-opening menu anchors (in other words, submenus that open below or above their anchor button) that allow upward and downward directional focus navigation into the menu panel (Allow MenuAnchor created menus to traverse the submenu via keyboard. #119532).
  • Adds [Home] and [End] key shortcuts/actions to the menu overlay
    • [Home] moves to the first menu item
    • [End] moves to the last menu item
  • Adds focus wrapping to the Submenu widget (but not the MenuAnchor widget) for non-apple platforms.
  • Splits the submenu focus handling action into a submenu button action and a submenu overlay action
  • Adds an overlayActions parameter to MenuAnchor to allow users to override the overlay actions.

This is a breaking change since it adds focus wrapping.

I'm open to suggestions regarding whether to add or remove more customizability to the menu shortcuts and actions. As mentioned, I'm not currently wrapping focus on the MenuAnchor but am wrapping focus on the SubmenuButton. This is because I didn't want to break existing submenus that are built atop MenuAnchor.

TODO: Migration guide.

EDIT: Waiting for #176494 to land in case animations affect focus behavior (AFAIK they should not).

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Oct 17, 2025
@Piinks

Piinks commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Greetings from stale PR triage! 👋
Is this change still on your radar?

@davidhicks980

Copy link
Copy Markdown
Contributor Author

@Piinks it is! I'm waiting for #176494 to land just in case it affects focus behavior.

@fluttergithubbot

Copy link
Copy Markdown
Contributor

An existing Git SHA, f916dd6887bf0242132ab6e86bd0a77bd6ff2089, was detected, and no actions were taken.

To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with --force) that already was pushed before, push a blank commit (git commit --allow-empty -m "Trigger Build") or rebase to continue.

@davidhicks980

Copy link
Copy Markdown
Contributor Author

I'm revisiting this issue now. I accidentally closed it while resolving merge conflicts, but will reopen when I have meaningful changes to push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow MenuAnchor created menus to traverse the submenu via keyboard.

3 participants