← Chrome 160 reference · All APIs
v160 · css · enabled by default
View Transitions: shadowRoots option in startViewTransition()
The shadowRoots option on StartViewTransitionOptions (defaulting to []) lets document.startViewTransition() and element.startViewTransition() discover view-transition-name, view-transition-class, and view-transition-group declarations inside explicitly supplied descendant ShadowRoots — enabling seamless animations across shadow and slotted light DOM without breaking shadow encapsulation.
at a glance
| Milestone / rollout | Published under /v160/ (matching the Chrome Platform Showcase v160 route); as of 2026-11-24 the ChromeStatus API record targets Chrome 161 across desktop, Android, and Android WebView (also listed in the milestone=161 listing) |
|---|---|
| Origin trial / flag | No origin trial, no user-facing chrome://flags entry. Blink runtime feature ViewTransitionShadowRoots is currently status: "experimental" in runtime_enabled_features.json5; test on Chromium builds with --enable-blink-features=ViewTransitionShadowRoots |
| Specification | CSS View Transitions Module Level 2 — StartViewTransitionOptions.shadowRoots (pending merge of CSSWG PR #14826) |
| CSSWG & TAG | w3c/csswg-drafts#12953 (resolved 11 November 2026 to add shadowRoots to StartViewTransitionOptions); w3ctag/design-reviews#1315 |
| Tracking bug | issues.chromium.org/584738355 |
| Chromium source | view_transition_options.idl; view_transition_style_tracker.cc |
| ChromeStatus | 5206462350622720 — View Transitions: shadowRoots option in startViewTransition() |
why it exists
In CSS View Transitions, view-transition-name, view-transition-class, and non-normal view-transition-group values are tree-scoped names. Previously, a transition started with document.startViewTransition() or element.startViewTransition() could only discover declarations in the same node tree as the transition’s root element — ignoring declarations authored inside Shadow DOM stylesheets. Web component authors had to expose internal elements via ::part() or move styles outside the shadow tree, breaking encapsulation and making it difficult to animate shadow internals alongside slotted light-DOM children. Passing an explicit shadowRoots list lets the code that already holds a ShadowRoot reference opt it into the transition without opening closed shadow roots to external callers.
Syntax
WebIDL from CSSWG PR #14826 extending StartViewTransitionOptions in CSS View Transitions Module Level 2 (shadowRoots is the new member; update and types are pre-existing dictionary members shown for context; Blink’s internal IDL file names this dictionary ViewTransitionOptions):
dictionary StartViewTransitionOptions {
ViewTransitionUpdateCallback? update = null;
sequence<DOMString>? types = null;
sequence<ShadowRoot> shadowRoots = [];
};
Pass the options dictionary to either Document.prototype.startViewTransition(options) (global document transition) or Element.prototype.startViewTransition(options) (element-scoped transition):
const transition = document.startViewTransition({
update: () => updateDOM(),
types: ["card-morph"],
shadowRoots: [cardHost.shadowRoot],
});
const scopedTransition = hostElement.startViewTransition({
update: () => updateComponent(),
shadowRoots: [privateClosedShadowRoot],
});
This reference covers both parts of the contract: the StartViewTransitionOptions.shadowRoots dictionary member and the participating tree roots resolution algorithm for view-transition-name, view-transition-class, and view-transition-group.
StartViewTransitionOptions.shadowRoots — inputs and outputs
Inputs. An optional iterable sequence of ShadowRoot objects (defaulting to an empty sequence []). Both open shadow roots (host.shadowRoot) and closed shadow roots (the reference returned by attachShadow({ mode: "closed" })) are accepted when held by the caller. Duplicate entries in the sequence are deduplicated when stored in the transition’s participating tree roots set.
Outputs. startViewTransition() returns a ViewTransition object whose internal participating tree roots set contains the transition root element’s own tree root (Document for a document transition, or element.getRootNode() for a scoped transition) unioned with every ShadowRoot supplied in shadowRoots. Including a ShadowRoot is not recursive: nested shadow roots inside an included shadow tree do not participate unless they are also listed explicitly in shadowRoots.
Pseudo-element tree placement. Passing shadowRoots expands where view-transition CSS properties are discovered, not where the transition pseudo-element tree is mounted. The generated ::view-transition, ::view-transition-group(), ::view-transition-image-pair(), ::view-transition-old(), and ::view-transition-new() pseudo-elements still live on the transition’s root element (the document element or the scoped host element).
Participating tree roots — name, class, and group resolution
During both old-state and new-state capture, Blink’s ViewTransitionStyleTracker::IsParticipatingTreeScope() and CSSWG PR #14826 restrict discovery to elements that are flat-tree inclusive descendants of the transition’s root element (not excluded by view-transition-scope: all) and then resolve three tree-scoped properties against participating tree roots:
| CSS property | When declaring tree root is in participating tree roots | When declaring tree root is NOT in participating tree roots |
|---|---|---|
view-transition-name (<custom-ident>, auto, match-element) | Resolves the identifier string with its tree root stripped, placing all participating trees into one shared flat namespace for the transition | Treated as none (element is not captured as a named participant) |
view-transition-class | Each scoped class identifier whose declaring tree root participates is appended to the element’s transition class list | Omitted from the element’s transition class list |
view-transition-group (contain, nearest, <custom-ident>) | Resolves normally against participating flat-tree ancestors | Falls back to normal |
Flat shared namespace across participating trees. Because stripping the associated tree root puts all participating trees into a single flat namespace for that ViewTransition, an element inside Shadow Root A and an element in light DOM (or Shadow Root B) with the same view-transition-name will pair and morph across tree boundaries if one is present in the old state and the other in the new state — and will collide as duplicate names if both are present simultaneously in the same capture state. Passing a ShadowRoot that is not a flat-tree descendant of a scoped transition’s root element has no effect because elements outside the root’s flat-tree subtree are never visited.
Errors, edge cases, and fallbacks
- Invalid
shadowRootsvalue (TypeError): WebIDL sequence conversion throws a synchronousTypeErrorifshadowRootsis not iterable or if any entry is not aShadowRootinstance (for example passing a hostElement,document, ornullinstead ofhost.shadowRoot). Filter out nullish values (e.g. when a host has no open shadow root) before callingstartViewTransition(). - Duplicate
view-transition-nameacross participating trees (InvalidStateError): Because participating light DOM and included shadow roots share a flat namespace, two elements with the sameview-transition-namein the same capture snapshot skip the transition and rejecttransition.readywithInvalidStateError(the DOM update still runs). - Standard transition skip errors: Calling
startViewTransition()on a disconnected element, a document without a view, or whiledocument.hiddenis true skips the transition and rejectstransition.readywithInvalidStateError; starting a new transition on the same root or calling during a navigation transition skips withAbortError. - Older browsers ignore unknown dictionary keys: Browsers that support
StartViewTransitionOptions({ update, types }) withoutshadowRootssilently ignore the unknownshadowRootskey. The DOM update still executes and a standard root crossfade runs, but shadow-declaredview-transition-names are not discovered. Because WebIDL dictionary members are read synchronously during argument conversion, passing a getter onshadowRootslets telemetry/code observe whether the browser read the property during a transition call.
Context and exposure
StartViewTransitionOptions.shadowRoots is available in Window contexts on both Document.prototype.startViewTransition() and Element.prototype.startViewTransition() (when element-scoped view transitions are supported). No secure context, permission, or user activation is required. To include a closed ShadowRoot, the call must originate from code that holds that ShadowRoot reference (typically inside the custom element’s own class).
Lifecycle, cleanup, and accessibility
The participating tree roots set is snapshotted synchronously when startViewTransition() creates the transition’s style tracker and is used identically during both old-state and new-state capture; mutating the caller’s array afterward has no effect. When the transition finishes or is skipped, Blink clears participating_tree_roots_ and removes the temporary ::view-transition pseudo-element tree. Because view transitions do not automatically move keyboard focus and can be disorienting for motion-sensitive users, route focus programmatically once transition.finished settles (or after the DOM update) and disable animations under @media (prefers-reduced-motion: reduce).
Examples
Live demo & custom element transitioning closed shadow DOM with slotted light DOM
shadowRoots. Source: Chrome Platform Showcase — View Transitions: shadowRoots option.class ExpandableCard extends HTMLElement {
#shadow;
constructor() {
super();
this.#shadow = this.attachShadow({ mode: "closed" });
this.#shadow.innerHTML = `
<style>
.badge { view-transition-name: card-badge; view-transition-class: card-piece; }
.panel { view-transition-name: card-panel; }
@media (prefers-reduced-motion: reduce) {
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) { animation: none !important; }
}
</style>
<div class="panel">
<span class="badge">Featured</span>
<slot></slot>
</div>
`;
}
toggleExpanded(expanded) {
const applyState = () => {
this.toggleAttribute("expanded", expanded);
};
// Prefer element-scoped transition if available, else fall back to document
const start = this.startViewTransition
? (opts) => this.startViewTransition(opts)
: document.startViewTransition
? (opts) => document.startViewTransition(opts)
: null;
if (!start) {
applyState();
this.querySelector("h2")?.focus();
return;
}
// Closed ShadowRoot stays encapsulated: only this component holds #shadow
const transition = start({
update: applyState,
shadowRoots: [this.#shadow],
});
transition.finished.finally(() => {
// Maintain logical keyboard focus after layout morphs
this.querySelector("h2")?.focus();
});
}
}
More live interactive demos on the Chrome Platform Showcase cover the capture inspector, design-system tabs, and ::part() workaround & edge cases.
Cross-shadow-root handoff with document.startViewTransition() and feature observation
// Morph a shared view-transition-name ("active-thumb") from one component's
// shadow tree into another component's shadow tree.
function moveThumb(fromCard, toCard, updateDom) {
const roots = [fromCard.shadowRoot, toCard.shadowRoot].filter(
(r) => r instanceof ShadowRoot,
);
if (!document.startViewTransition) {
updateDom();
return { supported: false };
}
let shadowRootsRead = false;
const options = {
update: updateDom,
get shadowRoots() {
shadowRootsRead = true;
return roots;
},
};
const transition = document.startViewTransition(options);
return { transition, supported: shadowRootsRead };
}
Source: CSSWG PR #14826; Blink view_transition_options.idl.
Browser compatibility
| Browser | shadowRoots option | Evidence / notes | Base Document / Element.startViewTransition() (BCD) |
|---|---|---|---|
| Chrome (desktop, Android, WebView) | 161 (planned) flag in dev | Filed under v160/; ChromeStatus 5206462350622720 targets Chrome 161 (desktop, Android, WebView); Blink ViewTransitionShadowRoots is currently status: "experimental" | Document: 111 (options 125)Element: 147 |
| Edge | Unknown | Chromium-based; follows Chromium milestone rollout (no BCD or wpt.fyi entry yet) | Document: 111 (options 125)Element: 147 |
| Firefox | No support | Mozilla standards position #1488: No signal | Document: 144 (options 147)Element: No support |
| Safari | No support | WebKit standards position #743: No signal | Document: 18 (options 18.2)Element: No support |
Security and privacy
The explicit shadowRoots sequence is a capability-based design chosen in CSSWG #12953 and TAG review #1315 specifically to preserve Shadow DOM encapsulation: alternatives such as automatic discovery across all shadow trees or a boolean includeShadowRoots flag were rejected because they would allow outer scripts to capture and animate internals of closed shadow roots without the component’s consent. With shadowRoots, only a caller that already holds a ShadowRoot object reference can opt that tree into the transition. ChromeStatus 5206462350622720 records no additional security risks; note that opted-in trees share a flat view-transition-name namespace with the transition root, so a host stylesheet can style the generated ::view-transition-* pseudo-elements for participating names.
Specifications
| Specification | Section |
|---|---|
| CSS View Transitions Module Level 2 (Editor’s Draft) | StartViewTransitionOptions.shadowRoots (via CSSWG PR #14826) |
see also
- Chrome Platform Showcase —
shadowRootsdemos - MDN —
Document.startViewTransition() - MDN —
Element.startViewTransition() - CSSWG #12953 — proposal and resolution
- CSSWG PR #14826 — specification patch
- W3C TAG design review #1315
- ChromeStatus — View Transitions: shadowRoots option in startViewTransition() (5206462350622720)