Commit 31a12c9
committed
Carry the menu popup contract onto the composer quick pills
The 插件 / 设计百宝箱 pills open the standalone `role="menu"` popovers in
ChatComposer, but they arrived without the contract of the ComposerPlusMenu rows
they replaced: no `aria-haspopup` / `aria-expanded`, no Escape handler, and no
focus return. Keyboard and screen-reader users could not tell a popup was open,
and Escape pressed while focus sat in the plugin search did nothing.
The pills live in ChatPane while the popovers live in ChatComposer, so the state
is plumbed both ways rather than duplicated:
- `onStandalonePanelChange` reports which popover is open, and each pill carries
`aria-haspopup="menu"` plus its own `aria-expanded` — the same pair
`ComposerPlusMenu` already puts on its trigger. No `aria-controls`: that
surface does not use one, and this is not the place to invent a second
convention.
- `openDesignToolbox` / `openPluginsPanel` take the opening pill as the
return-focus target. Both popovers move focus inside themselves, so a
dismissal has to hand it back, and the pill is the control the user came from.
- Escape closes through a document-level handler, mirroring ComposerPlusMenu's.
`dismissStandalonePanels` is deliberately only wired to the dismissal paths
(Escape, backdrop). Picking a plugin or an action keeps the plain setters,
because those hand focus to the composer input and pulling it back to the pill
would fight that.
No interaction changes: hover-open, the shared close timer, pill-to-popup
pointer travel and every selection path behave exactly as before.
Red first: `tests/components/ChatPane.quick-pill-popup-contract.test.tsx` runs
both pills through advertise / expand / Escape-from-inside / backdrop-dismiss and
asserts focus lands back on the pill. All six cases failed before this change.1 parent e48b871 commit 31a12c9
3 files changed
Lines changed: 191 additions & 10 deletions
File tree
- apps/web
- src/components
- tests/components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
276 | 280 | | |
277 | 281 | | |
278 | 282 | | |
| |||
347 | 351 | | |
348 | 352 | | |
349 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
350 | 357 | | |
351 | 358 | | |
352 | 359 | | |
| |||
377 | 384 | | |
378 | 385 | | |
379 | 386 | | |
380 | | - | |
381 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
382 | 390 | | |
383 | | - | |
384 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
385 | 394 | | |
386 | 395 | | |
387 | 396 | | |
| |||
447 | 456 | | |
448 | 457 | | |
449 | 458 | | |
| 459 | + | |
450 | 460 | | |
451 | 461 | | |
452 | 462 | | |
| |||
557 | 567 | | |
558 | 568 | | |
559 | 569 | | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
560 | 607 | | |
561 | 608 | | |
562 | 609 | | |
| |||
1157 | 1204 | | |
1158 | 1205 | | |
1159 | 1206 | | |
1160 | | - | |
| 1207 | + | |
1161 | 1208 | | |
1162 | 1209 | | |
| 1210 | + | |
1163 | 1211 | | |
1164 | 1212 | | |
1165 | 1213 | | |
1166 | 1214 | | |
1167 | 1215 | | |
1168 | | - | |
| 1216 | + | |
1169 | 1217 | | |
1170 | 1218 | | |
| 1219 | + | |
1171 | 1220 | | |
1172 | 1221 | | |
1173 | 1222 | | |
| |||
2761 | 2810 | | |
2762 | 2811 | | |
2763 | 2812 | | |
2764 | | - | |
| 2813 | + | |
2765 | 2814 | | |
2766 | 2815 | | |
2767 | 2816 | | |
| |||
2820 | 2869 | | |
2821 | 2870 | | |
2822 | 2871 | | |
2823 | | - | |
| 2872 | + | |
2824 | 2873 | | |
2825 | 2874 | | |
2826 | 2875 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
966 | 967 | | |
967 | 968 | | |
968 | 969 | | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
969 | 978 | | |
970 | 979 | | |
971 | 980 | | |
| |||
1079 | 1088 | | |
1080 | 1089 | | |
1081 | 1090 | | |
1082 | | - | |
1083 | | - | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
1084 | 1096 | | |
1085 | 1097 | | |
1086 | 1098 | | |
| |||
2152 | 2164 | | |
2153 | 2165 | | |
2154 | 2166 | | |
| 2167 | + | |
2155 | 2168 | | |
2156 | 2169 | | |
2157 | 2170 | | |
| 2171 | + | |
| 2172 | + | |
2158 | 2173 | | |
2159 | 2174 | | |
2160 | 2175 | | |
| |||
2163 | 2178 | | |
2164 | 2179 | | |
2165 | 2180 | | |
| 2181 | + | |
2166 | 2182 | | |
2167 | 2183 | | |
2168 | 2184 | | |
| 2185 | + | |
| 2186 | + | |
2169 | 2187 | | |
2170 | 2188 | | |
2171 | 2189 | | |
| |||
2231 | 2249 | | |
2232 | 2250 | | |
2233 | 2251 | | |
| 2252 | + | |
2234 | 2253 | | |
2235 | 2254 | | |
2236 | 2255 | | |
| |||
Lines changed: 113 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
0 commit comments