You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Escape: Close the menu that contains focus and return focus to the element or context, e.g., menu button or parent menuitem, from which the menu was opened.
In accordance with the WAI-ARIA Menu pattern[0]:
Escape: Close the menu that contains focus and return focus to the
element or context, e.g., menu button or parent menuitem, from which
the menu was opened.
[0]: https://www.w3.org/WAI/ARIA/apg/patterns/menubar/Fixesradix-ui#1933
In many ways the aria practices aren't pure specs and also leave stuff to interpretation.
This is one of those cases I think.
Escape: Close the menu that contains focus and return focus to the element or context, e.g., menu button or parent menuitem, from which the menu was opened.
One could interpret this both ways, ie. return to the top-level button OR the parent menuitem. It's not explicitly stated that it should be always menuitem for a submenu.
On top of this, as you point out in your PR #1964, MacOS doesn't behave like that.
Ultimately we took this approach for a few reasons:
submenus already have a key to wind down only the submenu (left arrow in LTR)
Bug report
Current Behavior
When focusing a menu item within a submenu,
escape
key closes all menus and submenus.Expected behavior
When focusing a menu item within a submenu,
escape
key closes only the containing submenu.Reproducible example
Radix Docs
Additional context
According to ARIA authoring practices:
Also, here's an example demonstrating correct behavior
Your environment
The text was updated successfully, but these errors were encountered: