Repository navigation
[context menu] Close the open menu on Tab - #6072
Conversation
commit: |
Bundle size
PerformanceNo regressions in 36 benchmarks · ran 3m 09s · details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@atomiks Please review when you get some time. |
|
The bug is real, but the PR makes Shift+Tab match the accidental behavior instead of the deliberate one. Where each behavior came from:
The PR description says a regular Menu has "the same split", but it doesn’t: a regular Menu closes on both Tab and Shift+Tab, with I'd make the Tab close the root context menu the same way Shift+Tab already does instead. Focus would go back to whatever had it before the menu opened. |
|
Thanks @michaldudak, that makes sense. Reworked in de8eba2.
Added |
|
Hi @michaldudak |
Shift+Tab closed a root context menu while Tab left it open.
The root context menu's modal focus manager swallowed Tab, so only Shift+Tab closed it. Tab now closes it the same way and returns focus, as a regular menu closes on both.
de8eba2 to
d3a792d
Compare
Fixes #6063.
Shift+Tab closed a root context menu and returned focus, but Tab did nothing. The context menu's focus manager is modal (since #3645), so its guard swallowed Tab when no item was tabbable.
Tab now closes the root context menu the same way Shift+Tab does, and focus goes back to whatever had it before the menu opened. A regular Menu already closes on both. Submenus and regular menus are unchanged.