Repository navigation
fix: defer animation start for add/replace to microtask - #11434
Merged
Merged
Conversation
web-padawan
force-pushed
the
fix/backdrop-animation-overlay
branch
3 times, most recently
from
April 1, 2026 09:05
3641854 to
0636ac4
Compare
For add/replace transitions, _finishTransition defers recalculateLayout to a microtask so Lit elements can render before measurement. But animation params (overlay detection, offscreen value) were read synchronously before the microtask ran, producing wrong values. Defer animation start to a second microtask so the execution order is: 1. updateCallback (DOM update + queue recalculate microtask) 2. Lit rendering microtask 3. recalculateLayout microtask (sets overlay, caches size) 4. Animation start microtask (reads correct CSS state) Move the version counter from __animateTransition to _startTransition so deferred animations can check for staleness on interruption. Rename __animateTransition to __runAnimations (no longer owns the Promise or version counter). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
web-padawan
force-pushed
the
fix/backdrop-animation-overlay
branch
from
April 1, 2026 09:52
0636ac4 to
00decff
Compare
Replace nested closures and manual Promise management with a linear async flow. Each await is a yield point guarded by a version counter for interruption safety. - _startTransition is now async with clear top-to-bottom flow - __runAnimations simplified: returns the slide Promise, no version counter or onFinish callback management - __endTransition: remove __transitionResolve (async function's implicit Promise resolves on return) - _finishTransition unchanged (still used by React wrapper) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
web-padawan
force-pushed
the
fix/backdrop-animation-overlay
branch
from
April 1, 2026 12:04
119e42b to
926684d
Compare
|
vursen
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Two improvements to master-detail-layout animation orchestration:
Fix: defer animation start for add/replace to microtask
_finishTransitiondefersrecalculateLayoutto a microtask (so Lit elements render before measurement). But animation params (overlay detection, offscreen value, backdrop fade) were read synchronously before the microtask ran, producing wrong values — most visibly, the backdrop fade-in never triggered.Fix: defer animation start to a subsequent microtask so the execution order is:
updateCallback— DOM update + queue recalculate microtaskrecalculateLayoutmicrotask — setsoverlay, caches intrinsic size[overlay]attribute)Refactor: convert
_startTransitionto async/awaitReplace nested closures and manual Promise/
__transitionResolvemanagement with a linear async flow. Eachawaitis a yield point guarded by a version counter for interruption safety._startTransitionis nowasyncwith clear top-to-bottom flow__runAnimationssimplified: returns the slide Promise, no version counter or onFinish callback__endTransition: removed__transitionResolvehandling (async function's implicit Promise resolves on return)_finishTransitionunchanged (still used by React wrapper)Test plan
yarn test --group master-detail-layout— 98 tests passyarn lint:js— pass🤖 Generated with Claude Code