Commit 0cd8c6d
authored
fix(admin): don't steal slash menu selection on stationary pointer (#1013)
When the slash menu opens, it renders right at the text cursor. If the
user's mouse pointer happens to sit at the same coords -- which is the
default in CI test environments where pointer position persists across
tests in the same file -- the menu's items received pointerenter the
moment they appeared and called setSelectedIndex, overriding the
keyboard-driven default selection of 0.
In CI this manifested as 5 deterministic-on-slow-runner failures in
tests/editor/slash-menu.test.tsx (highlights-the-first-item-by-default,
ArrowDown/ArrowUp navigation, wrap-around, Enter-converts-to-heading).
Diagnostic dumps from #1010 showed the menu rendering with item 3/4/5
selected instead of the expected item -- a constant offset that lined
up with the runner's lingering pointer Y coord.
Gate the per-item onMouseEnter handler on a hasMouseMovedRef that only
flips to true after a pointermove event on the menu container. Reset
the ref each time the menu closes. This preserves mouse-hover-selects
once the user is actually moving the pointer over the menu, but
ignores pointer-was-already-here, which is what we want.
The existing 'highlights item on mouse hover' test relies on
userEvent.hover, which under Playwright teleports the cursor to the
target and fires pointerenter but not pointermove -- so the test now
explicitly dispatches a pointermove on the menu container first,
matching the new contract.
Reverts the temporary diagnostic instrumentation from #1010 (workflow
artifact upload + diagWaitFor helpers in slash-menu.test.tsx) now that
we have the fix.
Closes #1010 follow-up.1 parent b6e5b66 commit 0cd8c6d
4 files changed
Lines changed: 48 additions & 73 deletions
File tree
- .changeset
- .github/workflows
- packages/admin
- src/components
- tests/editor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | 207 | | |
220 | 208 | | |
221 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1097 | 1097 | | |
1098 | 1098 | | |
1099 | 1099 | | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
1100 | 1116 | | |
1101 | 1117 | | |
1102 | 1118 | | |
| |||
1107 | 1123 | | |
1108 | 1124 | | |
1109 | 1125 | | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1110 | 1129 | | |
1111 | 1130 | | |
1112 | 1131 | | |
| |||
1123 | 1142 | | |
1124 | 1143 | | |
1125 | 1144 | | |
1126 | | - | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
1127 | 1153 | | |
1128 | 1154 | | |
1129 | 1155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | 192 | | |
244 | 193 | | |
245 | 194 | | |
| |||
338 | 287 | | |
339 | 288 | | |
340 | 289 | | |
341 | | - | |
342 | | - | |
| 290 | + | |
343 | 291 | | |
344 | 292 | | |
345 | 293 | | |
| |||
357 | 305 | | |
358 | 306 | | |
359 | 307 | | |
360 | | - | |
| 308 | + | |
361 | 309 | | |
362 | 310 | | |
363 | 311 | | |
| |||
373 | 321 | | |
374 | 322 | | |
375 | 323 | | |
376 | | - | |
| 324 | + | |
377 | 325 | | |
378 | 326 | | |
379 | 327 | | |
380 | 328 | | |
381 | 329 | | |
382 | | - | |
| 330 | + | |
383 | 331 | | |
384 | 332 | | |
385 | 333 | | |
| |||
393 | 341 | | |
394 | 342 | | |
395 | 343 | | |
396 | | - | |
| 344 | + | |
397 | 345 | | |
398 | 346 | | |
399 | 347 | | |
| |||
412 | 360 | | |
413 | 361 | | |
414 | 362 | | |
415 | | - | |
| 363 | + | |
416 | 364 | | |
417 | 365 | | |
418 | 366 | | |
| |||
539 | 487 | | |
540 | 488 | | |
541 | 489 | | |
542 | | - | |
543 | | - | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
544 | 499 | | |
545 | 500 | | |
546 | 501 | | |
| |||
0 commit comments