Skip to content

Fix ActionMenu mnemonic handling - #4168

Draft
scotttesler wants to merge 1 commit into
mainfrom
scotttesler-fix-action-menu-mnemonics
Draft

Fix ActionMenu mnemonic handling#4168
scotttesler wants to merge 1 commit into
mainfrom
scotttesler-fix-action-menu-mnemonics

Conversation

@scotttesler

Copy link
Copy Markdown

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

  • Low risk the change is small, highly observable, and easily rolled back. The behavior change is limited to printable-key mnemonic handling and has focused system coverage.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

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-group is 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.ts
  • npx tsc --noEmit
  • bundle exec rubocop test/system/alpha/action_menu_test.rb
  • Focused Chrome system tests for modified, unmatched, and matching mnemonics

Accessibility

  • No new axe scan violation - This change does not introduce any new axe scan violations.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0c6916f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ActionMenu opens on modified or unmatched mnemonic keypresses

1 participant