Repository navigation
fix(material/dialog): prevent visual jump by removing open class together with closing class - #34137
Open
abdul-karim-mia wants to merge 1 commit into
Open
abdul-karim-mia wants to merge 1 commit into
abdul-karim-mia wants to merge 1 commit into
Conversation
…ther with closing class When _startExitAnimation() is called, mdc-dialog--open was previously removed synchronously while mdc-dialog--closing was scheduled in a requestAnimationFrame callback. When close() is called from within a requestAnimationFrame callback (such as during zoneless change detection scheduling or effect reactions), the nested rAF is deferred to the next frame. During that intermediate frame, the dialog container renders with neither class, applying the base un-opened styles (scale(0.8) / opacity: 0) and causing the dialog surface to visibly shrink and then snap back. Remove mdc-dialog--open and add mdc-dialog--closing together within the requestAnimationFrame callback so the container transitions directly from the open state to the closing state without an intermediate class-less frame. Fixes angular#34123 Signed-off-by: Abdul karim mia <97598943+abdul-karim-mia@users.noreply.github.com>
This branch has not been deployed
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.
When
_startExitAnimation()is called,mdc-dialog--openwas previously removed synchronously whilemdc-dialog--closingwas scheduled in arequestAnimationFramecallback.When
close()is called from within arequestAnimationFramecallback (such as during zoneless change detection scheduling or reactive effect updates), the nested rAF is deferred to the next frame. During that intermediate frame, the dialog container renders with neither class, applying the base un-opened styles (scale(0.8)/opacity: 0) and causing the dialog surface to visibly shrink and then snap back whenmdc-dialog--closingis applied.Solution
Remove
mdc-dialog--openand addmdc-dialog--closingtogether within therequestAnimationFramecallback so the container transitions directly from the open state to the closing state without an intermediate class-less frame. When animations are disabled,mdc-dialog--openis removed immediately in the non-animated branch.Verification
tsc -p src/material/tsconfig.json --noEmit): clean on dialog files (0 errors).src/material/dialog/dialog.spec.tsasserting thatmdc-dialog--openis not removed prematurely before the closing animation frame executes.Fixes #34123