fix: modal closing with a custom animation, even if there are animated elements inside the modal #1159
+27
−24
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 is it?
Why is it needed?
transitionendandanimationendevents could fire on inner animations inside the modal instead of the modal container itself.Because these listeners were registered with
{ once: true }, they were removed after the first event, causing the modal closing logic to never run and leaving the modal partially open. As a result, the user could no longer interact with the page.For example, if there is an animated
placeholderon an<input>inside the modal, thetransitionendevent could fire on that placeholder before the modal’s own transition finishes. This would remove the listener too early and prevent the modal from closing completely.Before:
2025-10-21.18.43.39.mov
After:
2025-10-21.18.45.22.mov
Same issue
#1004
Checklist:
pnpm changeand documented my changes