Repository navigation
Animate toast height so the deck doesn't flicker under a resting pointer - #6243
Merged
Merged
Conversation
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.
What
Adds
heightto the toast transition so it animates alongsidetransform.Why
Reported in #studio: with two toasts showing ("Logged in to WordPress.com" + "Pulling changes..."), resting the pointer near the top edge of the back toast makes the deck flicker between spread and collapsed.
The back toast's height depends on the deck state: its own height when spread, the front toast's (taller) height when collapsed. Height had no transition but transform did, so on collapse the back toast snapped to the taller height while still sitting in its spread position. That grew it upward under the pointer, which re-entered the viewport, spread the deck, shrank the toast, the pointer left again, and so on.
With height and transform animating together, the toast's top edge moves in one direction during each transition, so it doesn't cross back over a pointer that isn't moving. Base UI's own toast example transitions height the same way.
Testing
I didn't reproduce the loop in a browser; this comes from frame-by-frame reading of the screen recording and the deck CSS. To check: trigger two toasts of different heights (e.g. log in and start a pull), hover so the deck spreads, then park the pointer just above the top toast's top edge. Before: flicker. After: the deck collapses once and stays.
Tag
@indentto continue the conversation here.