Repository navigation
Conversation
…e drawer zag registers the dialog's dismissable layer, and its Escape listener, up to a frame after the panel mounts. The exit tests pressed Escape as soon as the panel was visible, so a press could land first and be lost: 'Should report one finished exit per close' failed its first attempt in CI on main and on another branch. The listener is in place no later than the frame that moves focus into the panel, so wait for that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DrawerOverlay was the one Drawer sub-component without the test id
cascade, so tests could reach the backdrop only through zag's
data-part. With a root data-testid it now renders {id}--overlay, on
Drawer and on Dialog, which shares it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ckdrop The exit e2e only counted calls, which also passes when the callback fires at the end of the panel's shorter exit. Read the count in a document capture listener as the closed backdrop's fade ends: it runs before zag's own listener, which ends the exit, so it must still show the previous count. A panel-only build reads the bumped one there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The JSDoc said it fires right away when nothing animates; it fires about a frame after the close, and at once only in a hidden tab. It now also says that a tab hidden mid-exit can hold the callback until the tab is shown again, and that a drawer inside another one's content unmounts without firing when the outer one closes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Once the panel has finished its exit, the callback waits for the
backdrop. Turning overlay off in that window (overlay={!isMobile} during
a resize) unmounted the backdrop before its exit ended, so zag never
reported it and onExitComplete never fired for that close. While
closed, the provider now keeps the overlay value the drawer was last
open with, so the backdrop fades out and reports; a change applies on
the next open. Dialog shares the provider and gets the same fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guideline taught only the latch: keep the last entity after close so the content does not blank. It now says to reset state after the close in onExitComplete, which fires once the exit animation ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
This PR is included in version 4.20.2-rc-fix-drawer-exit-complete.1 |
9 tasks done
This branch has not been deployed
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.
What
Follow-ups to #513 (
onExitCompleteonDrawerandDialog), found by a claim-by-claim review of the overlay manager design (#514):overlayturning off mid-fade. Whenoverlayflips tofalseafter the panel's exit but while the backdrop still fades (overlay={!isMobile}during a resize), the backdrop unmounted without reporting, soonExitCompletenever fired. While closed, the drawer now keeps theoverlayvalue it was last open with; a change applies on the next open. Drawer and Dialog both.Drawer.e2e.ts› "Should report one finished exit per close" was retried as flaky onmain(run 44301136351) and on feat(overlay-manager): open the same Dialog or Drawer from anywhere #514 (run 44295252899). zag attaches the Escape listener a microtask or a frame after the content shows, so an Escape pressed as soon as the panel was visible was sometimes lost. The exit tests now press Escape once focus is inside the drawer.{id}--overlayfrom the test-id cascade, as the test-id rules require of every part; the check above locates it that way.onExitCompletefires "right away when there is no animation"; on zag 1.43.3 it fires about a frame after the close, and at once only in a tab that is already hidden. It now also says that a tab hidden mid-exit can delay it, and that a drawer inside another one's content does not fire when the outer one closes and unmounts it.detail-drawer.mdpoints atonExitCompletefor resetting state after the close.Additive: no breaking change, no migration.
Test plan
overlayflip, on Drawer and on Dialog). The new test failed before the fix (Tests 2 failed) and passes after itpnpm lint,pnpm typecheck,tsc --build tsconfig.app.json --noEmit, and the guideline word budgetscompiler:audit: no bailout inDrawerProvider.tsxorDrawerOverlay.tsx; its one Drawer entry,DrawerResizeHandle.tsx, predates this PRDrawerRootpatched to report on the panel alone, the recorded count readsExits finished: 1and the check fails🤖 Generated with Claude Code