Repository navigation
fix(aria/menu): activate interactive content inside menu items - #34093
sandeep780049 wants to merge 1 commit into
Conversation
|
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. |
7f6dbb4 to
95a2b96
Compare
|
@google-cla I signed it! |
95a2b96 to
f2d9330
Compare
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.
f2d9330 to
9a0a94c
Compare
|
Rebased onto Logic is unchanged from the original patch: |
What does this PR do?
Menu items can wrap native interactive elements (a link, a button, an input), but
Enter/Spaceonly ran the menu's selection logic. The wrapped element was neveractivated, so link items and items with
(click)handlers inside the content wereeffectively mouse-only.
MenuItemPatternnow resolves the interactive element rendered inside the item andclicks it when the item is triggered. The click bubbles up to the menu's existing
clickhandler, 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
src/aria/menu/menu.spec.tsfor a menu whose items wrap alink, a button, and no interactive content at all, asserting that
EnterandSpaceactivate the inner element and still report the selection.src/aria/private/menu/menu.tsandsrc/aria/menu/menu.spec.ts) passes.bazel test //src/aria/menu:unit_testscould not be run on my machine becauseBazel fails to resolve the
rules_sasstoolchain on Windows, unrelated to this change.