fix: prevent detail flash on close with fill forwards and rAF cancel#11419
Merged
Conversation
Two fixes to eliminate a one-frame flash when closing the detail: 1. Add fill: 'forwards' to Web Animations — keeps the final keyframe applied after the animation finishes, preventing the CSS resting state (translate: none from has-detail) from showing between animation end and the finished Promise resolution. Cleaned up when __endTransition cancels the animation, after the callback has already cleared has-detail. 2. Cancel pending ResizeObserver rAF in __endTransition — during the closing animation, ResizeObserver can capture stale layout state (hasDetail: true) into a deferred rAF that would re-apply has-detail on the next frame. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c33004a to
3e85e58
Compare
|
vursen
approved these changes
Mar 28, 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 fixes to eliminate a one-frame flash when closing the detail panel:
fill: 'forwards'on Web Animations — keeps the final keyframe applied after the animation finishes, preventing the CSS resting state (translate: nonefromhas-detail) from showing between animation end and thefinishedPromise resolution. The fill effect is cleaned up when__endTransitioncancels the animation, which happens after the callback has already clearedhas-detail.cancelAnimationFrame(this.__resizeRaf)in__endTransition— during the closing animation,ResizeObservercan fire and capture stale layout state (hasDetail: true) into a deferredrequestAnimationFrame. When the animation finishes, the callback correctly clearshas-detail, but the stale rAF would re-apply it on the next frame. Cancelling it in__endTransitionprevents the stale state from overwriting the correct post-transition state.Both fixes are needed:
fill: 'forwards'bridges the synchronous gap between animation end and Promise resolution, while the rAF cancel prevents the asynchronous ResizeObserver race.Test plan
yarn test --group master-detail-layout— all tests pass🤖 Generated with Claude Code