Commit 33c79ca
fix(react-menu): Escape in an open Menu does not trigger tabster actions
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>1 parent 56b12c6 commit 33c79ca
3 files changed
Lines changed: 29 additions & 4 deletions
File tree
- change
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
149 | 153 | | |
150 | 154 | | |
151 | 155 | | |
| |||
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
129 | 133 | | |
130 | 134 | | |
131 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
132 | 146 | | |
133 | 147 | | |
134 | 148 | | |
135 | 149 | | |
136 | 150 | | |
137 | 151 | | |
138 | | - | |
| 152 | + | |
139 | 153 | | |
140 | 154 | | |
141 | 155 | | |
| |||
0 commit comments