-
Notifications
You must be signed in to change notification settings - Fork 6
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
Only animate elements inside a frame #8
Comments
Thanks for this, and glad you're having fun with it :) I've not yet implemented animations for turbo frames as their lifecycle events are a little different (e.g. there isn't a From my brief experiments it seems like |
…oh and feel free to add a PR for that tailwind typo. Thanks! |
Thanks for your answer @domchristie ! Indeed, I forgot to mention it happens when the frame's navigations are promoted to visits (which makes sense). For a quick summary of how I currently disable the animations within a frame, I use a Stimulus controller on the root html element, which exposes Turn's <turbo-frame data-action="turbo:before-fetch-request->turn#stop turbo:visit@window->turn#start" data-turbo-action="advance" id="some-frame">
...
</turbo-frame> I made a PR to fix the small typo! |
That looks great! Thanks for sharing. I had a look at adding a |
Hi @domchristie , The best turn (lol) of event here would be for Turbo to add specific events to frames. Or pass a For example, visits would animate the whole page. Frames would only animate child nodes. And streams could animate re-rendered nodes but that may be too complicated (or not). That's only my opinion though! |
There might be some other ways to determine when a link click targets a frame. A combination of the following might help:
|
Hey @domchristie, checking the |
The code for tracking a click through to creating a |
@domchristie Thanks for making it clearer. I will perhaps try to dig around or find a workaround for it... All I could think of was that, Turbo adds a |
Oh nice idea! Yeh, it’ll be interesting to see if that could work. Off the top of my head, it still might be tricky to accurately match up the fetch event with the visit event, but an estimate might be doable |
I tried playing around with it a bit, and it seems that only POST requests include the |
Hello, thanks for making this library, it's a blast 🔥
One thing I am wondering is, would it be possible to only animate the elements inside a Turbo frame (when navigation or form submit happens and targets a frame)?
From what I understand, it doesn't look like it's possible at the moment looking at the disabling animations section. But would it be possible once that is fixed? It would help a lot as right now, the only solution I found is to disable Turn when the navigation starts, show some skeleton and then re-enable Turn when the frame is rendered.
By the way, I think there's a typo in the Tailwind usage :
should be
The text was updated successfully, but these errors were encountered: