Document.activeViewTransition is a read-only instance property that returns the ViewTransition currently active on the document, or null if none is running. Learn why MDN recommends it over saving references, how it pairs with document.startViewTransition(), cross-document pagereveal / pageswap access, and five hands-on examples.
01
Kind
Read-only property
02
Returns
ViewTransition | null
03
Status
Experimental
04
Scope
Document-scoped VT
05
Start via
startViewTransition()
06
Also via
pagereveal / pageswap
Fundamentals
Introduction
The View Transition API animates DOM updates smoothly. With document-scoped transitions you call document.startViewTransition(callback) to capture the old page state, run your DOM update, then animate to the new state.
Sometimes you start a transition in one place and need the same ViewTransition object elsewhere—to await finished, call skipTransition(), or check whether a transition is still running. MDN: document.activeViewTransition gives a consistent way to read the active transition without storing the return value yourself.
JavaScript
console.log(document.activeViewTransition); // null when idle (if supported)
💡
Beginner tip
You can also get a transition from document.startViewTransition() (same-document) or from event.viewTransition on pagereveal / pageswap (cross-document). activeViewTransition works in any context once a transition is active.
MDN: the activeViewTransition read-only property of the Document interface returns a ViewTransition instance representing the view transition currently active on the document.
Read-only — you read it; you do not assign to it.
Value — ViewTransition while active, otherwise null.
Experimental — Limited availability (not Baseline) on MDN.
Pair with — document.startViewTransition() for same-document transitions.
Cross-document — also reachable while a navigation transition runs (via page events or this property).
Foundation
📝 Syntax
JavaScript
document.activeViewTransition
Value
A ViewTransition, or null if the document has no active view transition.
MDN pattern
JavaScript
document.startViewTransition(() => {
updateUI();
});
if (document.activeViewTransition) {
console.log("A view transition is currently active");
}
document.activeViewTransition.finished.then(() => {
console.log("View transition finished");
});
Compare
⚖️ Document vs Element scope
API
Scope
Typical start
document.activeViewTransition
Whole document (same-document VT)
document.startViewTransition(…)
element.activeViewTransition
That element’s subtree
element.startViewTransition(…)
event.viewTransition
Cross-document navigation
pagereveal / pageswap events
Document-scoped transitions are common for SPA route changes and full-page UI swaps. Element-scoped transitions suit cards and widgets that animate without freezing the entire page. Detect each API separately—support can differ.
Cheat Sheet
⚡ Quick Reference
Goal
Code / note
Read active VT
document.activeViewTransition
Idle / none
null
Start same-document
document.startViewTransition(() => { … })
Feature-detect
"activeViewTransition" in Document.prototype
Await finish
document.activeViewTransition?.finished
Skip animation
document.activeViewTransition?.skipTransition()
MDN status
Experimental · Limited availability
Snapshot
🔍 At a Glance
Four facts about Document.activeViewTransition.
Kind
read-only
Instance
Returns
VT | null
ViewTransition
Status
experimental
Not Baseline
API
View Trans.
Document scope
Hands-On
Examples Gallery
Examples follow MDN Document: activeViewTransition. Labs feature-detect first. Real animations need a supporting browser and document.startViewTransition.
📚 Getting Started
Detect the property and read the idle null state.
Example 1 — Feature-Detect Safely
Check whether activeViewTransition exists on documents.
JavaScript
console.log({
hasActiveViewTransition: "activeViewTransition" in Document.prototype,
hasStartViewTransition: typeof document.startViewTransition === "function",
tip: "Document.activeViewTransition is experimental — feature-detect first."
});
Many browsers still report false. Treat missing support as normal and update the DOM without a view transition.
Example 2 — Idle Value Is null
Before any transition starts, the property should be null when present.
JavaScript
if (!("activeViewTransition" in document)) {
console.log("activeViewTransition not supported");
} else {
console.log({
activeViewTransition: document.activeViewTransition,
note: "null means no document-scoped transition is active"
});
}
Document.activeViewTransition is Experimental and not Baseline (CSS View Transitions Module Level 2). Always feature-detect and keep a plain DOM-update fallback. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Experimental · Not Baseline
Document.activeViewTransition
ViewTransition or null — the active document-scoped view transition.
LimitedExperimental
Google ChromeDocument VT — check current Chromium versions
Limited / Check
Microsoft EdgeFollow Chromium View Transition support
Limited / Check
OperaFollow Chromium where available
Limited / Check
Mozilla FirefoxMay lag — feature-detect both start and active props
Limited
Apple SafariCheck current Safari — feature-detect
Limited
Internet ExplorerNo View Transition API
No
Document.activeViewTransitionLimited
Bottom line: Detect activeViewTransition and document.startViewTransition before use. Prefer storing the return value when convenient; use activeViewTransition when you need the ongoing transition later. Never require view transitions for core UX.
Wrap Up
Conclusion
Document.activeViewTransition is an experimental read-only handle for the document-scoped ViewTransition currently running—or null when idle. Feature-detect it, pair it with document.startViewTransition(), and always keep a non-animated update path.
A ViewTransition instance for the view transition currently active on the document, or null if none is active.
MDN marks Document.activeViewTransition as Experimental and Limited availability (CSS View Transitions Module Level 2). It is not Deprecated or Non-standard.
Yes. You read it to get the active ViewTransition (or null). You do not assign a transition to the property.
document.startViewTransition() starts a same-document transition and returns a ViewTransition. activeViewTransition lets you read that ongoing transition later without keeping your own reference.
When the document has no active view transition — before one starts, after it finishes, or if the API is unsupported.
Document.activeViewTransition is document-scoped (whole-page same-document transitions and cross-document cases via pagereveal/pageswap). Element.activeViewTransition is for element-scoped transitions on a single element subtree.
Did you know?
MDN lists three ways to reach the current ViewTransition: the return value of document.startViewTransition(), event.viewTransition on cross-document pagereveal / pageswap events, and document.activeViewTransition—the last one works uniformly without saving a reference first.