hotwired / turbo-rails

Use Turbo in your Ruby on Rails app
https://turbo.hotwired.dev
MIT License
2.13k stars 329 forks source link

using the view transitions API? #652

Closed koenhandekyn closed 4 months ago

koenhandekyn commented 4 months ago

i'm trying to use the view transitions api to have animations between "pages". see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API

the transition animations are not consistently running (sometimes they do, sometimes they don't). i've experimented with an extra trigger like this, but without success:

document.addEventListener('turbo:after-render', (event) => {
   console.log("turbo:before-render", "start view trnasition");
   document.startViewTransition(() => updateDOM());
});

does anyone have experience with the view transitions api in combination with turbo?

dhh commented 4 months ago

Turbo now has native view transition support: https://turbo.hotwired.dev/handbook/drive#view-transitions