Fix ActionMenu mnemonic handling - #4168
Draft
scotttesler wants to merge 1 commit into
Draft
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
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.
Prevents modified and unmatched mnemonic keypresses from opening a closed ActionMenu.
What are you trying to accomplish?
Ignore Control-, Command-, and Alt-modified printable keypresses during mnemonic handling, and leave a closed menu unchanged when no item mnemonic matches. Unmodified matching mnemonics continue to open the menu and focus the matching item.
Integration
No production integration updates are required.
List the issues that this change affects.
Risk Assessment
What approach did you choose and why?
Check the keyboard event's modifier flags before mnemonic lookup, while intentionally leaving Shift available for case-insensitive mnemonic matching. If lookup produces no matching item, return before popover or focus handling instead of allowing a negative index to select the final item.
This keeps the change at the shared mnemonic behavior boundary without altering arrow-key navigation or matching mnemonic behavior.
Anything you want to highlight for special attention from reviewers?
focus-groupis shared by ActionMenu and SelectPanel, so the modifier and unmatched-key guards apply consistently to both components.Verification
npx eslint app/components/primer/focus_group.tsnpx tsc --noEmitbundle exec rubocop test/system/alpha/action_menu_test.rbAccessibility
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.