fix(aria/menu): close open submenu when typeahead moves focus in menubar#33491
Open
Daherkarim wants to merge 1 commit into
Open
fix(aria/menu): close open submenu when typeahead moves focus in menubar#33491Daherkarim wants to merge 1 commit into
Daherkarim wants to merge 1 commit into
Conversation
Previously, when a menubar item was clicked to open its submenu and the user then used typeahead to move focus to another menubar item, the new item's submenu opened while the previously clicked item remained expanded, leaving two submenus open at the same time. Typeahead navigation in the menubar now closes the previously expanded item and moves the open state to the newly focused item, matching the behavior of arrow key and pointer navigation. If no submenu was open, or typeahead does not move focus, the expanded state is left untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a menubar item was clicked to open its submenu and the user then used typeahead to move focus to another menubar item, the new item's submenu opened while the previously clicked item remained expanded, leaving two submenus open at the same time.
This change makes typeahead navigation in the menubar close the previously expanded item and move the open state to the newly focused item, matching the behavior of arrow key and pointer navigation. If no submenu was open, or typeahead does not move focus (no match, or the match is the already-active item), the expanded state is left untouched.
The duplicated close-and-reopen logic in
goto,nextandprevwas consolidated into a shared_switchExpandedItemhelper, which typeahead now also uses.Changes
src/aria/private/menu/menu.ts: close the previously expanded menubar item when typeahead moves focus; consolidate the logic shared withgoto/next/prev.src/aria/menu/menu.spec.ts: unit tests covering typeahead with an open submenu, with no open submenu, and when focus does not move.src/components-examples/aria/menubar+src/dev-app/aria-menubar: a typeahead example for manual testing in the dev app.Testing
bazel test //src/aria/menu:unit_testspasses (Chromium and Firefox).