hotwired/turbo-rails

using the view transitions API?

koenhandekyn opened this issue · 1 comments

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

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