Skip to content

fix(aria/menu): activate interactive content inside menu items - #34093

Open
sandeep780049 wants to merge 1 commit into
angular:mainfrom
sandeep780049:fix/menu-enter-activates-interactive-content
Open

sandeep780049 wants to merge 1 commit into
angular:mainfrom
sandeep780049:fix/menu-enter-activates-interactive-content

Conversation

@sandeep780049

Copy link
Copy Markdown

What does this PR do?

Menu items can wrap native interactive elements (a link, a button, an input), but
Enter/Space only ran the menu's selection logic. The wrapped element was never
activated, so link items and items with (click) handlers inside the content were
effectively mouse-only.

MenuItemPattern now resolves the interactive element rendered inside the item and
clicks it when the item is triggered. The click bubbles up to the menu's existing
click handler, so the item is still selected exactly as it is on a mouse click —
keyboard and mouse now behave the same. Items without interactive content keep their
current behavior, and menu bar items still open their submenu first.

Fixes #34072.

Testing

  • Added unit coverage in src/aria/menu/menu.spec.ts for a menu whose items wrap a
    link, a button, and no interactive content at all, asserting that Enter and
    Space activate the inner element and still report the selection.
  • Type checking of the changed sources (src/aria/private/menu/menu.ts and
    src/aria/menu/menu.spec.ts) passes.
  • Note: bazel test //src/aria/menu:unit_tests could not be run on my machine because
    Bazel fails to resolve the rules_sass toolchain on Windows, unrelated to this change.

@google-cla

google-cla Bot commented Nov 7, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@pullapprove
pullapprove Bot requested review from crisbeto and tjshiu November 7, 2026 06:38
@sandeep780049
sandeep780049 force-pushed the fix/menu-enter-activates-interactive-content branch from 7f6dbb4 to 95a2b96 Compare November 7, 2026 06:39
@sandeep780049

Copy link
Copy Markdown
Author

@google-cla I signed it!

Menu items can wrap native interactive elements such as links and buttons, but
Enter and Space only ran the menu selection logic, so the wrapped element was
never activated and link items were effectively mouse-only.

`MenuItemPattern` now resolves the interactive element rendered inside the item
and clicks it when the item is triggered, which bubbles up to the menu's click
handler and selects the item exactly like a mouse click does. Items that don't
wrap interactive content keep the previous behavior, and menu bar items open
their submenu first, as before.

Fixes angular#34072.
@sandeep780049
sandeep780049 force-pushed the fix/menu-enter-activates-interactive-content branch from 95a2b96 to f2d9330 Compare November 7, 2026 06:56

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(aria/menu): Enter on a menu item doesn't activate the element, so link items and (click) handlers are mouse-only

1 participant