Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
CSS

CSS: Fix a View Transition That Silently Never Animates Because Two Elements Share the Same view-transition-name at the Same Time

- 21.10.26 - ErcanOPAK

🎨 The Page Transition That Just… Doesn’t

The View Transitions API animates between two DOM states by matching elements that share the same view-transition-name across the old and new snapshot. That matching only works if each name is unique within a single transition’s old and new states – if two elements anywhere on the page end up with the same view-transition-name at the same moment, even briefly, the browser can’t resolve which one the transition actually belongs to and silently skips animating that pair rather than throwing a visible error.

🔎 The Problem

/* Intended: each product card gets its own named transition so
   clicking into a product smoothly morphs its thumbnail into the
   detail page's hero image. */
.product-card__thumbnail {
  view-transition-name: product-hero;
}

.product-detail__hero {
  view-transition-name: product-hero;
}

/* Works correctly for a single product page. Breaks the moment the
   product list renders MULTIPLE cards on screen at once - every
   .product-card__thumbnail on the page gets the exact same
   view-transition-name, "product-hero", simultaneously.

   document.startViewTransition() then finds more than one element
   claiming the same name in the "old" snapshot, can't disambiguate
   which one the transition is "for", and the transition silently
   falls back to a plain, unanimated snap - no console error,
   no visual glitch to point at, just a transition that quietly
   never happens. */

✅ Fix: Make Every Name Unique to a Single Element at a Time

  • Generate the view-transition-name dynamically per item – product-hero-42 using the product’s own ID – rather than a single shared static name, so every card on a list page has a distinct name and only the one the user actually clicked shares its name with the detail page’s hero image.
  • Set the dynamic name only on the specific element involved in the upcoming transition (right before calling startViewTransition, or via a CSS custom property scoped to that one element) rather than leaving every card permanently named – a name that’s only unique ‘most of the time’ will eventually collide again.
  • Use the browser’s DevTools Rendering panel or the View Transition debugging tools to confirm which elements actually participated in a given transition – a transition that silently no-ops gives no error message, so visually confirming participation is the only reliable way to catch this.

🚨 Why This Is Dangerous

  • Testing a single product page in isolation, or a list with only one visible card, never exposes the collision – it only appears once a real list page renders enough cards at once for two of them to share a name simultaneously, which is often well after the feature has already shipped.
  • The failure mode is a silent, unanimated page change rather than a crash or a console error, so it’s easy to mistake for ‘the transition doesn’t work in this browser’ or a performance issue, when the actual cause is a naming collision that a developer testing on a mostly-empty list page would never have seen.

A view-transition-name is a promise that exactly one element will answer to it – the moment two do, the browser doesn’t guess, it just quietly declines to animate either one.

— UI Engineer

Related posts:

overflow-x: hidden Is Not a Layout Fix

overflow-x: hidden Is Not a Layout Fix

CSS: Use Grid auto-fit and minmax for Responsive Layouts Without Media Queries

CSS: Use Grid auto-fit and minmax for Responsive Layouts Without Media Queries

CSS: Why a Pinned Overlay Starts Scrolling With the Page the Moment a Parent Element Gets Any transf...

CSS: Why a Pinned Overlay Starts Scrolling With the Page the Moment a Parent Element Gets Any transf...

Views: 6

Post navigation

C#: Fix a Nullable Reference Type Warning That Silently Never Appears Because the Project Enabled Nullable Only for Newly Added Files
The AI Prompt That Compares Two Job Offers on Everything Beyond the Salary Number—Benefits, PTO, Remote Policy, and Real Growth Path

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« Oct    

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,055)
  • Get the User Name and Domain Name from an Email Address in SQL (980)
  • How to add default value for Entity Framework migrations for DateTime and Bool (977)
  • Get the First and Last Word from a String or Sentence in SQL (858)
  • How to select distinct rows in a datatable in C# (854)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (653)
  • Add Constraint to SQL Table to ensure email contains @ (609)
  • Average of all values in a column that are not zero in SQL (570)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (547)
  • Find numbers with more than two decimal places in SQL (475)

Recent Posts

  • C#: Fix a ConditionalWeakTable Entry Vanishing Too Soon
  • Docker: Fix a Stale COPY Layer After Editing .dockerignore
  • Photoshop: Fix a Pattern Overlay Scaling Wrong on a High-DPI File
  • SQL Server: Fix a Computed Column Index Skipped by Implicit Cast
  • HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit
  • SQL Server: Fix ROW_NUMBER Ties Reordering Between Identical Runs
  • C#: Fix an Enum HasFlag Returning True for the Zero Value
  • WordPress: Fix Featured Images Vanishing After a CDN Migration
  • Photoshop: Fix Content-Aware Fill Smearing a Repeating Pattern
  • Asp.Net Core: Fix Antiforgery Tokens Rejected Behind a Reverse Proxy

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,055)
  • Get the User Name and Domain Name from an Email Address in SQL (980)
  • How to add default value for Entity Framework migrations for DateTime and Bool (977)
  • Get the First and Last Word from a String or Sentence in SQL (858)
  • How to select distinct rows in a datatable in C# (854)

Recent Posts

  • C#: Fix a ConditionalWeakTable Entry Vanishing Too Soon
  • Docker: Fix a Stale COPY Layer After Editing .dockerignore
  • Photoshop: Fix a Pattern Overlay Scaling Wrong on a High-DPI File
  • SQL Server: Fix a Computed Column Index Skipped by Implicit Cast
  • HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com