Skip to content

Add view transition effects#177

Closed
john-sp wants to merge 2 commits intoLeelaChessZero:masterfrom
john-sp:animation
Closed

Add view transition effects#177
john-sp wants to merge 2 commits intoLeelaChessZero:masterfrom
john-sp:animation

Conversation

@john-sp
Copy link
Member

@john-sp john-sp commented Oct 19, 2025

Adds a simple fade between all pages, for blog posts, the title animates in to place.

Copilot AI review requested due to automatic review settings October 19, 2025 21:17
@github-actions
Copy link

🚀 Draft Preview: https://pr177-draft.lc0.org/

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Enables cross-document View Transitions for a site-wide fade effect and links blog list titles to post titles for shared element transitions.

  • Opts into navigation transitions when users do not prefer reduced motion.
  • Adds deterministic view-transition-name to blog summary/title elements to animate titles from list to detail pages.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
themes/leela/assets/css/main.css Enables View Transitions API for navigation when motion is allowed.
layouts/blog/section.html Adds view-transition-name to each blog summary title using a stable hash.
layouts/blog/page.html Adds the same view-transition-name to the blog post h1 to match the list item.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}

}

Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider explicitly disabling navigation transitions for users who prefer reduced motion to ensure accessibility regardless of UA defaults. Add a complementary block: @media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }.

Suggested change
@media (prefers-reduced-motion: reduce) {
@view-transition {
navigation: none;
}
}

Copilot uses AI. Check for mistakes.
{{ range $paginator.Pages }}
<div class="blog-summary">
<div class="blog-summary-title">
<div class="blog-summary-title" style="view-transition-name: post-title-{{ printf "%s/%s" .Language.Lang .Path | hash.FNV32a }};">
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The hash expression is inlined here and also in page.html; compute it once in a local variable to avoid duplication and make it easier to change later. Example: {{- $vt := printf "%s/%s" .Language.Lang .Path | hash.FNV32a -}} then style=\"view-transition-name: post-title-{{$vt}};\".

Copilot uses AI. Check for mistakes.

<div class="blog-date">{{ .PublishDate.Format "2006-01-02" }}</div>
<h1 class="blog-title">{{ .Title }}</h1>
<h1 class="blog-title" style="view-transition-name: post-title-{{ printf "%s/%s" .Language.Lang .Path | hash.FNV32a }};">{{ .Title }}</h1>
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Mirror the approach from section.html by assigning the hashed value to a local variable and reusing it, which reduces duplication and risk of mismatch across templates. Example: {{- $vt := printf "%s/%s" .Language.Lang .Path | hash.FNV32a -}} then use post-title-{{$vt}}.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

🚀 Draft Preview: https://pr177-draft.lc0.org/

@mooskagh
Copy link
Member

mooskagh commented Nov 7, 2025

Hmm doesn't really look like an improvement to me..

In general when a user wants immediate response and instead some animation starts to play, it feels sluggish.

@john-sp john-sp closed this Nov 7, 2025
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.

3 participants