Bug: Dialog and TransitionRoot is not working as documented
See original GitHub issueWhat package within Headless UI are you using?
What version of that package are you using?
v1.4.2
What browser are you using?
Chrome
Reproduction URL
<template>
<!--
Use the TransitionRoot component to add transitions. Use the appear prop
to animate your dialog on initial render.
-->
<TransitionRoot
appear
:show="isOpen"
enter="duration-300 ease-out"
enter-from="opacity-0"
enter-to="opacity-100"
entered="TRANSITION-ROOT-ENTERED"
leave="duration-200 ease-in"
leave-from="opacity-100"
leave-to="opacity-0"
>
<!--
Add `@close` to your Dialog.
-->
<Dialog @close="setIsOpen">
<DialogOverlay />
<DialogTitle>Deactivate account</DialogTitle>
<!-- ... -->
<button @click="isOpen = false">Close</button>
</Dialog>
</TransitionRoot>
</template>
Describe your issue
The code snippet above is copied from the headlessui dialog doc, and it’s not working as expected. The dialog is not transitioning. I suspect it’s because the dialog is portaled away, while <transition-root>
itself is not.
See css class TRANSITION-ROOT-ENTERED
is still being rendered in the original place rather than portaled away.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:12
Top Results From Across the Web
Transition - Headless UI
For animating a Dialog , or coordinating multiple transitions on any other component, use the TransitionRoot component from Headless UI instead.
Read more >Headless UI v1.0 - Tailwind CSS
Headless UI v1.0 brings our React Transition component to Vue as well, which makes it a lot easier to transition things like modal...
Read more >Using Modal from headless ui in vue3 - Stack Overflow
I tried to pass a prop in the Modal.vue but it's not working, my strategy was to use a modalActive prop and watch...
Read more >Laracasts Profile: msslgomez
It's correct but there shouldn't be one, that's the problem. ... <script setup> import { TransitionRoot, TransitionChild, Dialog, DialogPanel, } ...
Read more >vite js require is not defined | The AI Search Engine You Control
<client-only> <TransitionRoot as="template" :show="open"> <Dialog as="div" ... Datatable does not work in Laravel 9 & Vite; Error jQuery is not defined.
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
Thanks @RobinMalfait . Maybe I’m misunderstanding your answer, but that it still not working for me. I’ve created a minimal reproduction here.
https://github.com/jiblett1000/headless-test
Tried with using the insiders version (vue) to see if that resolved it for me as well. Unfortunately, if it is fixed, I can’t tell because it now won’t allow me to close the dialog.