Skip to content

ActionMenu opens on modified or unmatched mnemonic keypresses #4167

Description

@scotttesler

Description

A closed ActionMenu can open when its invoker has focus and the user presses a single-character key, including modified browser shortcuts such as Command+R or Control+R and characters that do not match any item mnemonic.

Steps to reproduce

  1. Render a single-select ActionMenu.
  2. Focus its invoker while the menu is closed. Selecting an item first is one way to return focus to the invoker.
  3. Press Command+R, Control+R, or a single-character key that does not match an item.

Expected behavior

  • Modified shortcuts do not open the menu.
  • An unmatched mnemonic does not open the menu or focus an item.
  • An unmodified matching mnemonic continues to open the menu and focus the matching item.

Actual behavior

The menu opens before the shortcut or keypress completes. When no mnemonic matches, focus moves to the last item.

Environment

Reproduced with Primer ViewComponents v0.53.1 and current main.

Acceptance criteria

  • Control-, Command-, and Alt-modified character keypresses do not trigger mnemonic handling.
  • Unmatched character keypresses leave a closed menu closed.
  • Matching unmodified mnemonic behavior remains unchanged.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions