fix: clip custom toast content overflow in stacked view#749
Open
iampankajghosh wants to merge 1 commit intoemilkowalski:mainfrom
Open
fix: clip custom toast content overflow in stacked view#749iampankajghosh wants to merge 1 commit intoemilkowalski:mainfrom
iampankajghosh wants to merge 1 commit intoemilkowalski:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Author
|
Gentle ping! Happy to make any changes if needed. cc @emilkowalski |
|
hi, thank you for fix and nice video! just wanted to say that for position="top-*" it cuts wrong it's due to separate bug, that in position="top-*" children are growing from top, not the bottom. but still worth mentioning here, I think |
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 does this PR fix?
Fixes #748
Problem
When using
toast.custom(), stacking a short toast in front of a tall toastcauses the bottom of the taller toast to bleed through the shorter front toast.
Default toasts are unaffected — the issue is isolated to custom/JSX toasts.
Root Cause
Sonner clips the stack using
--front-toast-heighton the list container. Fordefault toasts, overflow is handled implicitly by their internal structure. For
custom toasts, the
[data-content]wrapper grows to its natural content heightand punches through the parent's clipped boundary because it never receives
overflow: hiddenorheight: 100%.Fix
Added a CSS rule scoped to
[data-front='false']that constrains[data-content]to the parent's height and clips the overflow:
This is tightly scoped — it only applies to non-front toasts in the stack,
so it has zero impact on the front toast or any other state.
Testing
Manually verified with tall + short
toast.custom()combinations inChrome, Firefox, and Safari.
Demo
Before
before-fix.mp4
After
after-fix.mp4