question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Dialog and TransitionRoot is not working as documented

See original GitHub issue

What package within Headless UI are you using?

@headlessui/vue

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. image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:12

github_iconTop GitHub Comments

1reaction
jiblett1000commented, Mar 3, 2022

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

0reactions
jiblett1000commented, Apr 12, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found