v160 · css · view transitions

View Transitions: shadowRoots option in startViewTransition()

view-transition-name is tree-scoped: a name declared inside a component’s shadow tree is invisible to document.startViewTransition(), so design-system components could not take part in page transitions without leaking names out through ::part(). Chrome 160 adds a shadowRoots sequence to the options dictionary (default []). List a ShadowRoot there and the transition — on the document or on an element — also discovers view-transition-name, view-transition-class and view-transition-group declared inside it. Only the roots you list participate, so encapsulation is opt-in, never automatic.

Running it today: the member is behind the Blink runtime feature ViewTransitionShadowRoots (status “experimental” in Chromium main). Turn on chrome://flags/#enable-experimental-web-platform-features, or launch Chrome/Canary with --enable-blink-features=ViewTransitionShadowRoots. Every page probes the real dictionary member and shows exactly what your browser captured — browsers without the feature silently ignore the option, and the pages say so.

concepts

  1. Shadow card morph

    The canonical call. A <profile-card> declares its avatar and name transition names in its own shadow stylesheet. Expand it with document.startViewTransition({ update, shadowRoots: [card.shadowRoot] }), then without the option, and read which names the browser actually captured.

  2. Capture inspector

    Open, closed, nested and out-of-scope shadow roots on one stage. Choose which roots to list and whether the transition starts on the document or an element, then inspect every name: its tree scope, whether the participation rules expect it, whether it was captured, and whether a shadow-declared view-transition-class was honoured.

  3. Design-system tabs

    Why components need it: a <ds-tabs> element whose sliding indicator lives in its shadow tree while the panels are slotted light DOM. The component runs an element-scoped transition on itself, lists its own shadow root and passes a direction type, so both trees animate together. Keyboard-operable tabs.

  4. ::part() workaround & edge cases

    Migration and failure modes: the old ::part() workaround next to the new option, a duplicate name across two trees that skips the transition, TypeError for a non-ShadowRoot or null entry, and why outside code can never list a closed shadow root.

why it shipped

View transition names are tree-scoped, so a transition started on a document or element could not find names declared inside shadow trees. Authors worked around it by exposing internals with ::part() and declaring the name in the outer stylesheet, or by moving styling out of the shadow tree — both break encapsulation, and neither lets a component animate its shadow internals together with its slotted light-DOM content. The CSS Working Group resolved on 11 November 2026 to add a shadowRoots list rather than automatic discovery or an “include all” boolean, so the code that owns a shadow root decides whether it participates.

the API

dictionary StartViewTransitionOptions {
  ViewTransitionUpdateCallback? update = null;
  sequence<DOMString>? types = null;
  sequence<ShadowRoot> shadowRoots = [];   // new
};

// Inside a component's shadow stylesheet:
//   .avatar { view-transition-name: card-avatar; }

document.startViewTransition({
  update: () => card.toggleAttribute("expanded"),
  shadowRoots: [card.shadowRoot],          // opt this tree in
});

// Element-scoped transitions take the same option:
this.startViewTransition({ update, shadowRoots: [this.#root] });

Participation rules in Chromium’s implementation: a name counts when its element is a flat-tree descendant of the transition’s scope and the stylesheet that declared it belongs to the scope’s own tree or to a listed root. Nested shadow roots must each be listed, and names from all listed trees share one namespace.

references