Transition does not call `afterLeave` when using nested Transition.Child
See original GitHub issueWhat package within Headless UI are you using?
What version of that package are you using?
v1.7.2
What browser are you using?
Chrome
Reproduction URL
https://codesandbox.io/s/headlessui-transition-bug-afterleave-3k435m?file=/src/App.tsx:666-1441
- Open link above
- Open console of Code Sandbox
- Click on the “Click to transition” button
- Observe that
console.log('unmount')
inafterLeave
callback never gets called.
Describe your issue
When using a nested Transition.Child within a Transition component, the afterLeave
callback from the Transition component doesn’t get called when the exit transition ends.
Related: https://github.com/tailwindlabs/headlessui/issues/1364
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Transition calls `afterLeave` callback too early when ... - GitHub
Child components finished their leave animation. But now the Transition component calls this callback immediately and doesn't wait for ...
Read more >How to simultaneously transition colour of nested children
So, the real issue is that the transition-duration property seems to be additive for children, see how slow it takes to remove the...
Read more >Transition | Vue.js
Although the transition classes are only applied to the direct child element in <Transition> , we can transition nested elements using nested CSS...
Read more >Transition - Headless UI
The Transition component lets you add enter/leave transitions to conditionally rendered elements, using CSS classes to control the actual transition styles in ...
Read more >Nested div CSS transition not working - CodeProject
I have a navigation bar with a dropdown on one of the nav_items. Each nav_item has a CSS transition on its color property,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey!
Going to close this one for now. If you can reproduce the issue with the
Transition
on the outside then feel free to open a new issue with a reproduction repo / CodeSandbox attached. We can also re-open this issue, but interactions on older PRs/issues tend to get lost quicker.I hope you figured it out for your use case 💪
The
open
prop of the DialogRoot controls its focus trap, scroll lock, etc. which is why it’s in sync with theshow
prop of the Transition component. All those things should get disabled at the moment the exit transition starts. It doesn’t unmount any components because of theforceMount
prop on all the Radix components (that’s the intended way to use Radix with close animations).I’ll try to put the Transition on the outside and report back.