🎨 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.

