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

data-turbo-permanent fails when using CSS View Transitions #1048

Open
rctneil opened this issue Oct 26, 2023 · 2 comments
Open

data-turbo-permanent fails when using CSS View Transitions #1048

rctneil opened this issue Oct 26, 2023 · 2 comments

Comments

@rctneil
Copy link

rctneil commented Oct 26, 2023

As you can see in this thread: https://discuss.hotwired.dev/t/keep-audio-playing/5400/1

It looks like View Transitions cause my data-turbo-permanent elements to disappear and effectively not work.

I am using latest Turbo as of this post.

My View Transitions code is:

addEventListener("turbo:before-render", (event) => {
  if (document.startViewTransition) {
    const originalRender = event.detail.render
    event.detail.render = (currentElement, newElement) => {
      document.startViewTransition(()=> originalRender(currentElement, newElement))
    }
  }
})

addEventListener("turbo:before-frame-render", (event) => {
  if (document.startViewTransition) {
    const originalRender = event.detail.render
    event.detail.render = (currentElement, newElement) => {
      document.startViewTransition(()=> originalRender(currentElement, newElement))
    }
  }
})

Is there a fix or solution to this?

@rctneil
Copy link
Author

rctneil commented Nov 2, 2023

Any suggestions or a fix for this?

@adrienpoly
Copy link
Member

@rctneil you might want to try using View Transition with the Turn js package https://github.com/domchristie/turn as of today for me it is the most reliable implementation for page transition.

Turbo has a PR merged (#935) for it but this is not yet part of an official release

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

No branches or pull requests

2 participants