-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transition enterFrom classes not working as expected #1503
Comments
Same issue here, Broken on |
Hey! Thank you for your bug report! This should be fixed by #1519, and will be available in the next release. You can already try it using Can you verify that this works using the insiders build? Thanks! |
works for me on |
Yup, me too. Thanks! |
I think there is a similar issue now on |
seeing a similar issue with the enter transition not working. have a simple toast like this
the leaveFrom transition is working, but the enterTo is not. some added context: this is the sibling of another Another strange thing is that on the dialog that is a sibling, the enterTo transition is working fine. Any thoughts ? Broken on v1.7.11 and 1.17.15 (latest) |
Just hit this on latest 1.17.14 for vue. Solution was to use the separate transitions for backdrop and dialog as mentioned in the docs: https://headlessui.com/vue/dialog#transitions |
Still having this issue on As an example:
It seems like the "enterFrom" classes are just not being applied. Right now enterFrom has opacity-50 but whether I remove that or add some other class it wouldn't change. So it always begins with the default opacity-100. So you can animate from 100 to 0 or any similar combo, but can't animate from opacity-0 to opacity-100 for example. So this makes it so any child under this Transition component appears immediately, but the fade-away effect after you close it works as expected. |
Same here. Broken on <Transition
show={pasteMode}
appear={true}
enter="transition-all duration-[10s] ease-in-out"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="transition-all duration-[10s] ease-in-out"
leaveFrom="opacity-100"
leaveTo="opacity-0"
> |
This was originally introduced in #1519 to fix an issue where some enter transitions where broken: #1503 However, since we refactored the `Transition` component to make use of the `useTransition` hook, I can't seem to reproduce this issue anymore. In fact, removing this code fixes an issue. The bigger issue here is that when the component becomes hidden, that we always set the state to hidden as well. But if it becomes visible again, we don't show it again. Right now, since I couldn't reproduce any of the other issue, I opted to just removing the code entirely. But if we ever need it again, we probably have to make sure that it becomes visible in the other scenario as well. Fixes: #3328
…dden (#3372) * do not change visibility of `Transition` component This was originally introduced in #1519 to fix an issue where some enter transitions where broken: #1503 However, since we refactored the `Transition` component to make use of the `useTransition` hook, I can't seem to reproduce this issue anymore. In fact, removing this code fixes an issue. The bigger issue here is that when the component becomes hidden, that we always set the state to hidden as well. But if it becomes visible again, we don't show it again. Right now, since I couldn't reproduce any of the other issue, I opted to just removing the code entirely. But if we ever need it again, we probably have to make sure that it becomes visible in the other scenario as well. Fixes: #3328 * update changelog
This is still happening in version |
+1 Yeah 1.7.16 works, but broken in 1.7.22 |
Can confirm, drawer from the Tailwind UI docs (https://tailwindui.com/components/application-ui/overlays/drawers#component-2036cb51318151226ce814d3e3efea91) has this issue on Seems related to #3456 |
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
1.6.3
What browser are you using?
Chrome/Firefox
Reproduction URL
https://github.com/tailwindlabs/headlessui/blob/main/packages/playground-react/pages/transitions/component-examples/peek-a-boo.tsx
https://github.com/tailwindlabs/headlessui/blob/main/packages/playground-react/pages/transitions/component-examples/modal.tsx
https://headlessui.dev/react/transition
Describe your issue
Many of the examples for
Transition
in playground-react, the headlessui documentation and Tailwind UI applytransition
in theclassName
orenter
attributes to achieve an enter effect. Some of these do not seem to be working as intended.For example, take the React playground
peek-a-boo
example below:Notice how the
div
starts off with a transparent background rather than a red background despite havingenterFrom
set tobg-red-500
.The same issue exists with the modal - it is supposed to be fading in but instead just pops in:
Setting
unmount={false}
fixes the problem.Digger deeper, I think I can see why this is happening. Taking the example from the
Transition
documentation:At least in Chrome, this appears to have the following behaviour:
Transition
component applies theenter
andenterFrom
classes for 1 frame. The classesduration-75
andopacity-0
were just applied, but the existingopacity
is100
, so the browser starts animating fromopacity: 100
toopacity: 0
.100
to0
(settingopacity
to something like 0.97). TheTransition
component then removes theenterFrom
classes and applies theenterTo
classes. This starts animating from the current opacity ofopacity: 0.97
back toopacity: 1
opacity
reaches 1 andtransitionend
fires.Applying a
className
ofopacity-0
fixes this issue, because the opacity is already 0 when theenterFrom
classes are applied. Alternatively, applyingtransition-opacity
andduration-75
toenterTo
rather thanenter
fixes the problem because the browser does not try to animate theenterFrom
.This behaviour is a little confusing, particularly given many of the examples suffer from this problem. Is there a way to improve this? For example, could
transition-property
be set tonone
when applyingenterFrom
?The text was updated successfully, but these errors were encountered: