headlessui icon indicating copy to clipboard operation
headlessui copied to clipboard

Transition calls `afterLeave` callback too early when using `Transition.Child`

Open dcastil opened this issue 3 years ago • 5 comments
trafficstars

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v1.6.0

What browser are you using?

Chrome

Reproduction URL

https://codesandbox.io/s/headlessui-transition-bug-afterleave-3k435m?file=/src/App.tsx:589-1336

Describe your issue

In v1.5.0 the afterLeave call of the Transition component was called after all Transition.Child components finished their leave animation. But now the Transition component calls this callback immediately and doesn't wait for animations of its child transition.

I rely on the afterLeave callback to know when it is safe to unmount a component with an exit animation.

dcastil avatar Apr 25 '22 15:04 dcastil

Exact same problem with afterEnter

pvandamme avatar Apr 27 '22 16:04 pvandamme

Yea version >= v1.6.0 has broken exit transitions in my transitions in Vue as well 👍

stevebauman avatar May 10 '22 17:05 stevebauman

I am not getting my leaveFrom transition React ^17 TW ^3 // using sass integration as well headlessUI ^1.5.0 next ^12

JamieGarcia123 avatar Jun 09 '22 18:06 JamieGarcia123

Also facing this issue

gregghawes avatar Jun 28 '22 12:06 gregghawes

Looks like they're actively working on it! https://github.com/tailwindlabs/headlessui/pull/1585

radiylon avatar Aug 05 '22 19:08 radiylon

This should be fixed by #1803, and will be available in the next release.

You can already try it using npm install @headlessui/react@insiders.

Here is an updated CodeSandbox with the latest insiders version: https://codesandbox.io/s/headlessui-transition-bug-afterleave-forked-ukknut?file=/src/App.tsx

RobinMalfait avatar Sep 01 '22 23:09 RobinMalfait

Can confirm that it works. Thanks! 🙏

dcastil avatar Sep 12 '22 09:09 dcastil

I'm now experiencing the very same issue in @headlessui/vue 1.7.9 🤔

zipper avatar Feb 07 '23 12:02 zipper