fix: Escape in an open Menu does not trigger tabster actions#36313
Merged
layershifter merged 3 commits intoJun 18, 2026
Merged
Conversation
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
layershifter
force-pushed
the
fix/react-menu-escape-tabster-groupper
branch
from
June 16, 2026 09:37
bbd0440 to
6e4657c
Compare
A Menu nested in a tabster groupper/modalizer (e.g. a focusMode Card, or a list item whose actions popover shares a modalizer scope with the item) moves focus to the groupper root when Escape closes the menu, instead of restoring focus to the trigger. The MenuPopover keydown handler calls event.preventDefault(), but tabster listens for keydown in the capture phase on the document, so it can't be stopped from the popover handler and still runs its own Escape behaviour (escaping the parent groupper). This is the same problem fixed for react-combobox in microsoft#36275. Fix: add the tabster `focusable.ignoreKeydown: { Escape: true }` attribute on the MenuPopover. The popover only renders while the menu is open, so the attribute is only ever present on an open menu (and Escape still works normally elsewhere) — no need to gate it on the open state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
layershifter
force-pushed
the
fix/react-menu-escape-tabster-groupper
branch
from
June 16, 2026 10:20
6e4657c to
33c79ca
Compare
layershifter
marked this pull request as ready for review
June 16, 2026 12:44
pompomon
approved these changes
Jun 18, 2026
bsunderhus
approved these changes
Jun 18, 2026
layershifter
enabled auto-merge (squash)
June 18, 2026 14:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Previous Behavior
A
Menunested in a tabster groupper/modalizer (e.g. a Card withfocusMode, or a reaction popover that shares a modalizer id with a parent message groupper) moves focus to the groupper root when Escape closes the menu, instead of restoring focus to the trigger.The
MenuPopoverkeydown handler callsevent.preventDefault()(and the comment intends to stop propagation), but tabster listens forkeydownin the capture phase on the document, so neither prevents tabster's own Escape behaviour from escaping the parent groupper.New Behavior
Adds the tabster
focusable.ignoreKeydown: { Escape }attribute on theMenuPopover, gated on the menu being open — so tabster ignores Escape while the menu handles it to close, and Escape still functions normally when the menu is closed.This is the same fix applied to
react-comboboxin #36275 (useTriggerSlot). It lives on theMenuPopover(rather than the trigger) because for a menu, focus moves into the menu items, and tabster aggregatesignoreKeydownfrom the focused element's ancestors.Related Issue(s)