Skip to content

feat: cross-fade page navigations with view transitions - #185

Merged
magnus-madsen merged 1 commit into
masterfrom
view-transitions
Aug 3, 2026
Merged

feat: cross-fade page navigations with view transitions#185
magnus-madsen merged 1 commit into
masterfrom
view-transitions

Conversation

@magnus-madsen

Copy link
Copy Markdown
Member

Summary

  • Opt same-origin navigations into browser-native cross-document view transitions (@view-transition { navigation: auto; }), so page loads cross-fade instead of flashing white
  • Give the navbar its own view-transition-name so it holds perfectly still while only the page content fades
  • Disable the transition under prefers-reduced-motion

CSS-only change: these remain real full-page navigations, so the inline navbar and carousel scripts are unaffected. Chrome/Edge 126+ and Safari 18.2+ get the cross-fade; browsers without support (e.g. Firefox) ignore the at-rule and keep todays behavior. Combined with the already-enabled prefetchAll, navigation should now look near-seamless.

Test plan

  • npm run build passes; verified the @view-transition blocks and view-transition-name survive CSS bundling into dist/_astro/Layout.*.css
  • Manual: click between pages in Chrome/Safari and observe a cross-fade with a stationary navbar; verify Firefox still navigates normally

🤖 Generated with Claude Code

Opt same-origin navigations into browser-native cross-document view
transitions so page loads cross-fade instead of flashing white. The
navbar is snapshotted separately so it holds still during the fade,
and the transition is disabled under prefers-reduced-motion. Browsers
without support (e.g. Firefox) keep plain full-page loads.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@magnus-madsen
magnus-madsen merged commit a5f96b8 into master Aug 3, 2026
2 checks passed
@magnus-madsen
magnus-madsen deleted the view-transitions branch August 3, 2026 14:51
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.

1 participant