Commit a1b9cbf
committed
fix: honour an open that arrives while the dropbox is still closing
PopoverComponent.show() early-returns for as long as `pop-comp-active` is
on the element, and only its own afterHide removes that class. So
openDropbox() called during the ~200ms hide transition did all of its own
work - beforeOpen, aria-expanded="true", the instance back in
openInstances - while popper.show() quietly did nothing. afterShowPopper()
never ran, so there was no `focused` class, no focus moved into the list
and no afterOpen; the hide that was still pending then completed on top of
it.
The dropdown ended up shut with its combobox still announcing
aria-expanded="true", and focus inside it dropped to <body>. The host's
open() was silently lost - it looks like nothing happened, which is the
worst shape for a bug to have.
Reachable through the public open() API only: toggleDropbox() sees
isOpened() === true for the whole transition, so a second click closes
again rather than reopening.
openDropbox() now queues instead of running when the popover is mid-hide,
and afterHidePopper() replays the open once the popover is idle again -
immediately before the existing "stand down if the dropdown is open again"
guard, so the replay reuses the one path that already knows not to hide an
open dropdown rather than adding a second. closeDropbox() clears the
queue, so a close arriving after the queued open wins.
Both conditions are required to queue. isClosingTransition alone would
strand every later open if it were ever left set with no hide actually
pending; isShown() alone is true of a dropdown that is simply already
open, where re-opening must stay a no-op rather than a queued one.
Together they mean exactly "a hide is running and the popover will refuse
to show". Nothing reaches into dropboxPopover.popper to cancel its timer -
that would couple this component to the plugin's internals - so the cost
is one extra fade before the dropdown appears, which is inherent: the
popover cannot show while it is hiding.
Queueing before any work also keeps the event contract intact. Letting
openDropbox() run and re-running it from afterHidePopper() would dispatch
beforeOpen twice for one open(), which would make a host that lazy-loads
options on beforeOpen fetch twice.
test: pin the reopen against the popover's hide transition
reopen-during-hide-transition.cy.ts, five cases: the reopen ends up open
and on screen, the open actually finishes (focus in the search input, the
`focused` class), beforeOpen and afterOpen each fire exactly once, a close
following the queued open cancels it, and an ordinary open with no hide
running is still applied synchronously rather than deferred.
The first three were red against the previous commit. Each waits out the
hide and the show that has to follow it before asserting: every assertion
also holds during the fade - openDropbox() sets aria-expanded and clears
aria-hidden synchronously, and the popover has not yet applied
display:none - so a retrying should() would otherwise latch onto that
transient and pass against the bug.
a11y-aria-hidden-focus.cy.ts's mid-transition case is rewritten. Its
premise - that the reopen is lost - no longer holds, so it now pins the
accessibility half of the queued path: the queue must hold the pointer
gate up for the rest of the fade, so the list cannot take DOM focus back
while the hide is still on its way to marking the subtree hidden.1 parent ab70d57 commit a1b9cbf
3 files changed
Lines changed: 255 additions & 63 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
425 | | - | |
426 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
427 | 428 | | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
444 | 432 | | |
445 | | - | |
| 433 | + | |
446 | 434 | | |
447 | 435 | | |
448 | 436 | | |
449 | 437 | | |
450 | 438 | | |
451 | | - | |
| 439 | + | |
| 440 | + | |
452 | 441 | | |
453 | 442 | | |
454 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
455 | 446 | | |
456 | | - | |
457 | | - | |
458 | | - | |
| 447 | + | |
459 | 448 | | |
460 | 449 | | |
461 | 450 | | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
| 451 | + | |
| 452 | + | |
467 | 453 | | |
468 | 454 | | |
469 | 455 | | |
470 | 456 | | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
| 457 | + | |
481 | 458 | | |
482 | 459 | | |
483 | | - | |
484 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
485 | 464 | | |
486 | 465 | | |
487 | 466 | | |
| |||
| 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 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1404 | 1404 | | |
1405 | 1405 | | |
1406 | 1406 | | |
| 1407 | + | |
| 1408 | + | |
1407 | 1409 | | |
1408 | 1410 | | |
1409 | 1411 | | |
| |||
2993 | 2995 | | |
2994 | 2996 | | |
2995 | 2997 | | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
2996 | 3022 | | |
2997 | 3023 | | |
2998 | 3024 | | |
| |||
3097 | 3123 | | |
3098 | 3124 | | |
3099 | 3125 | | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
3100 | 3129 | | |
3101 | 3130 | | |
3102 | 3131 | | |
| |||
3224 | 3253 | | |
3225 | 3254 | | |
3226 | 3255 | | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
3227 | 3259 | | |
| 3260 | + | |
3228 | 3261 | | |
3229 | 3262 | | |
3230 | 3263 | | |
| |||
3260 | 3293 | | |
3261 | 3294 | | |
3262 | 3295 | | |
3263 | | - | |
3264 | | - | |
3265 | | - | |
3266 | | - | |
3267 | | - | |
3268 | | - | |
3269 | | - | |
3270 | | - | |
3271 | | - | |
3272 | | - | |
3273 | | - | |
3274 | | - | |
3275 | | - | |
3276 | | - | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
3277 | 3312 | | |
3278 | | - | |
3279 | | - | |
| 3313 | + | |
| 3314 | + | |
3280 | 3315 | | |
3281 | 3316 | | |
3282 | 3317 | | |
| |||
3507 | 3542 | | |
3508 | 3543 | | |
3509 | 3544 | | |
3510 | | - | |
3511 | | - | |
3512 | | - | |
3513 | | - | |
3514 | | - | |
| 3545 | + | |
| 3546 | + | |
| 3547 | + | |
| 3548 | + | |
3515 | 3549 | | |
3516 | 3550 | | |
3517 | 3551 | | |
| |||
0 commit comments