demo · v140
Cleanup Race
Common pattern: a view transition runs, then a .finished handler resets the box style. Pre-140 the reset happened a frame too late and showed a tiny flicker. Click below to fire the transition; the log records the order of events.
API not detected
Your browser doesn't expose
document.startViewTransition. The demo still toggles, just without a transition.
hero
const vt = document.startViewTransition(() => box.classList.toggle("alt"));
vt.finished.then(() => {
log("finished resolved");
box.classList.add("cleanup"); // tiny scale animation
requestAnimationFrame(() =>
log("rAF after finished — does the cleanup paint cleanly?"));
});
see also
- VT finished promise timing — feature index
- Timing Diagram