[Bug]: Dialog/TransitionRoot does not animate when launched from inside `MenuItem`
See original GitHub issueWhat package within Headless UI are you using?
What version of that package are you using?
1.1.0
What browser are you using?
Chromium
Reproduction repository
Describe your issue
I’m using a Menu
to launch this slideout. I’m using the same function between buttons. The slideout doesn’t animate when from inside a MenuItem
component, but does with a regular button.
This doesn’t animate
<MenuItem v-slot="{ active }">
<button
:class="[
active ? 'bg-fuchsia-500 dark:bg-fuchsia-600 text-white' : 'text-gray-900 dark:text-gray-100',
'group flex rounded-md items-center w-full px-2 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-gray-300 dark:focus:ring-gray-500',
]"
@click.prevent="togglePermissions(user)"
>
Permissions
</button>
</MenuItem>
This does
<button @click="togglePermissions(users.data[0])">
Click
</button>
Sorry about the lack of repo, hopefully the video is enough to go off of. Both the dropdown and menu were lifted straight from the example.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:13
Top Results From Across the Web
android - Animated menu item "jumps" when animation starts
It works fine, except that the style doesn't seem to be right. When I click the item, it starts rotating, but only after...
Read more >Fixed issues in Animate release - Adobe Support
Here's a list of issues we fixed in the latest release of Animate. ... Duplicated symbols are not placed inside the Duplicated Items...
Read more >Animating Views and Transitions — SwiftUI Tutorials
Animating Views and Transitions. When using SwiftUI, you can individually animate changes to views, or to a view's state, no matter where the...
Read more >Animation transitions and triggers - Angular
Wildcard is a fallback value that's used if the state being animated isn't declared within the trigger. src/app/open-close.component.ts content_copy transition ...
Read more >Animation | Jetpack Compose - Android Developers
Overview. Animations are essential in a modern mobile app in order to realize a smooth and understandable user experience. Many Jetpack Compose Animation...
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
I solved it by making the button the parent element. Still can’t really understand why it solved the problem.
This bugged me for several hours - tried to follow all the suggestions here and @RobinMalfait’s great example - but nothing seemed to help.
So for anyone in the same boat:
When opening slideovers/popups etc., the first focusable element is automatically focused by the Dialog component.
When I removed all focusable elements inside the Slideover, the animation worked again. I think there is an initialFocus setting on the Dialog component to control this - but I didn’t have luck using it. And I don’t know why the focused element in this way cancels the animation.
Since I needed my focusable elements and couldn’t just remove them (checkboxes in this case), I put a v-if=“mounted” on them:
Might be a bit of a hack - but now my slideover is animating both in and out, and I’m happy.
Hope it can help someone!