Skip to content

Delegate to Turbo's view-transitions if enabled#20

Open
pascallaliberte wants to merge 1 commit intodomchristie:mainfrom
pascallaliberte:delegate-view-transitions-to-turbo
Open

Delegate to Turbo's view-transitions if enabled#20
pascallaliberte wants to merge 1 commit intodomchristie:mainfrom
pascallaliberte:delegate-view-transitions-to-turbo

Conversation

@pascallaliberte
Copy link

Fixes #19

Makes Turn automatically detect when <meta name="view-transition" content="same-origin"> is present and disables its own view transitions, letting Turbo handle them natively. This solves the redirect abort issue while preserving Turn's CSS animation capabilities.

Detecting if the page has the view-transition same-origin meta tag

With this PR, Turn auto-detects the native view-transition meta tag and delegates to Turbo when present. This works per-page (like data-turn="false"), giving us control over which pages use Turn's view transitions vs Turbo's native handling.

This works because:

  • Turbo's ViewTransitioner naturally spans the entire navigation, including redirect follow-ups
  • Turn's exit animation completes before render (unaffected by redirect)
  • Turbo's view transition handles the DOM swap
  • Turn's enter animation runs after render (unaffected by redirect)
  • The reset() call on redirect follow-up has nothing to abort - NullTurn.abort() is a no-op

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

Successfully merging this pull request may close these issues.

View transitions abort prematurely when server responds with a redirect

1 participant