Skip to content
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

TransitionRoot animation skipped when navigating #2

Closed
sebastiaanluca opened this issue Jun 28, 2022 · 6 comments
Closed

TransitionRoot animation skipped when navigating #2

sebastiaanluca opened this issue Jun 28, 2022 · 6 comments

Comments

@sebastiaanluca
Copy link

A thing I noticed with Inertia, Headless UI, and using TransitionRoot is that it will skip the configured transition (or end it early) when navigating to or away from the modal route. Had a similar experience with a custom implementation. Kind of depends on how fast the route loads. When navigating to, it usually just pops up without transition. When navigating away, it starts but abruptly hides the modal when halfway.

I assumed @after-leave="redirect" would take care of this because it only starts navigating after the transition ended, but it doesn't.

Is there a way to fix this or configure it differently so it would fully transition in and out when navigating routes?

@lepikhinb
Copy link
Owner

For the opening transition, you need to set the appear property to make the transition work on an initial request.

Please check the example implementation.

@sebastiaanluca
Copy link
Author

sebastiaanluca commented Jun 28, 2022

I have that set (I used the modal and edit view from the examples), but because the page loads too fast, it skips it entirely or halfway.

<TransitionRoot appear as="template" :show="show" @after-leave="redirect">
    …

Either @after-leave="redirect" triggers too fast (duration set to 500ms using duration-500) or it ignores it and navigates instantly. Anyhow, it happens on page load too, so I'm thinking there's something with the transitions and mounting/unmounting the component.

@lepikhinb
Copy link
Owner

By the way, do you use the latest version of Headless UI? They have that feature broken in 1.6.5. Try downgrading to 1.6.4.

@sebastiaanluca
Copy link
Author

That works like a charm! Sorry for the ticket 😅 And thanks for the package!

For those interested, the related tickets:

@lepikhinb
Copy link
Owner

It’s all good! Thank you for testing it out

@lepikhinb
Copy link
Owner

@sebastiaanluca also, I'd recommend putting the @after-leave event on a single TransitionChild instead of TransitionRoot, as it seems, that the root component fires the event for every transition child.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants