Repository navigation
Slide toasts in and out past the same edge - #188
Merged
Merged
Conversation
Need: a toast reads as one calm motion, arriving and leaving the same way. Problem: it rose from the bottom in 150ms with no fade, then slid out to the right. Solution: it fades while sliding past its viewport edge both ways, eases in over 400ms, and only fades under reduced motion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
In Studio the toast felt abrupt and lopsided. It rose from the bottom in 150ms, fully opaque, then left by sliding out to the right. The right-hand exit is the shadcn default, borrowed from Radix's swipe-right gesture, so closing a toast normally reused the swipe-away motion.
What
Fixes (4.10.2)
One motion in and out. The toast now fades while it slides its full height from just past the viewport edge it sits on, and leaves the same way:
smup it sits bottom-right and moves to and from the bottom. Belowsmit sits at the top and moves to and from the top.cubic-bezier(0.16, 1, 0.3, 1), and closes over 250ms with an ease-in curve.prefers-reduced-motion, the toast only fades.The tw-animate utilities are now plain keyframes in the CSS module. As utilities, the swipe-end and close rules would compete for the same animation, and which one won would depend on how Tailwind sorts them.
These values were tuned in Studio with a temporary override. Studio will drop that override when it bumps to this release.
Not in this PR
When a new toast replaces the current one, the old one still vanishes without an exit.
ToastRootremounts the provider on each new toast to work around Radix's stuck pause timer. Fixing it means revisiting that workaround, which is a separate change.🤖 Generated with Claude Code