fix(ui): enable dialog close animation#1102
Merged
Merged
Conversation
DialogManager was unmounting dialogs immediately when closeDialog() set dialogType to null in the store, so Radix UI Presence never had a chance to play the exit animation. Keep the last active dialog in the React tree by only updating renderType and renderProps when a new dialog opens (dialogType !== null). BaseDialog derives open from the store directly, so it correctly gets open=false and Radix runs the fade-out before Presence unmounts the content. Also add [animation-duration:200ms] to dialog and alert-dialog: in Tailwind v4 the duration-200 utility only sets transition-duration, while tailwindcss-animate defaults to 150ms for animation-duration.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes missing close (exit) animations for Radix UI dialogs by preventing dialogs from being immediately removed from the React tree when closeDialog() sets dialogType to null, and it aligns the dialog animation duration with the intended 200ms timing under Tailwind v4.
Changes:
- Update
DialogManagerto keep rendering the last active dialog component while the store transitionsdialogTypetonull, allowing Radix Presence to run exit animations. - Add an explicit
[animation-duration:200ms]to dialog and alert-dialog content to ensure animation duration matches 200ms (sinceduration-200only affects transition-duration in Tailwind v4).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ui/leafwiki-ui/src/components/ui/dialog.tsx | Adds explicit animation duration to ensure dialog enter/exit animation timing is 200ms. |
| ui/leafwiki-ui/src/components/ui/alert-dialog.tsx | Adds explicit animation duration to ensure alert-dialog enter/exit animation timing is 200ms. |
| ui/leafwiki-ui/src/components/DialogManager.tsx | Keeps the last dialog mounted after close to allow Radix Presence exit animations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keeping the dialog mounted indefinitely would preserve local React state (form inputs etc.) across close/reopen cycles. Use a 200ms timeout matching the animation duration to unmount after Radix Presence has finished the fade-out, restoring the original lifecycle semantics.
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.
DialogManager was unmounting dialogs immediately when closeDialog() set dialogType to null in the store, so Radix UI Presence never had a chance to play the exit animation.
Keep the last active dialog in the React tree by only updating renderType and renderProps when a new dialog opens (dialogType !== null). BaseDialog derives open from the store directly, so it correctly gets open=false and Radix runs the fade-out before Presence unmounts the content.
Also add [animation-duration:200ms] to dialog and alert-dialog: in Tailwind v4 the duration-200 utility only sets transition-duration, while tailwindcss-animate defaults to 150ms for animation-duration.