-
-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sonner z-index always behind radix-ui dialog #357
Comments
Try positioning it directly beneath React render, on the same level as the App component. ReactDOM.createRoot(document.getElementById('app')!).render(
<>
<App />
<Portal.Root>
<Toaster richColors />
</Portal.Root>
</>
); this worked after I tried |
@LF112's approach is correct. |
What about Next.js (13+) which doesn't have an This doesn't work either.
|
I found the issue, radix ui's dialog put's |
Edit: Found a fix 👇
@emilkowalski might be good to add this to Toaster itself? Running into this issue as well 😓 Putting
|
Let's close this? Adding the style to the |
I'm not sure this should be closed: yes the snackbars are now clickable, but they cause the Dialog to be closed as they are recognized as outside clicks. To allow click-through we need to consume the internal library @radix-ui/react-dismissable-layer which allows for item for be clicked outside of modality boundaries. For posterity (and possibly fixing this), I've managed to correctly compose the scope to have both components behave correctly. return toast.custom(
t => (
<DismissableLayer.Branch asChild>
<Snackbar
...
/>
</DismissableLayer.Branch>
), opts
) considering the current implementation, I'm not quite sure on how this could be achievable using the other methods. Additionally, we need'd to wrap the {/* Radix Portal */}
<Portal>
{/* Allow composability within Radix portals. */}
<DismissableLayer.Root asChild>
<Toaster
...
/>
</DismissableLayer.Root>
</Portal> But this isn't currently possible, as I have opened #491 to add the ref forwarding ability, but I'm at a loss on how to allow wrapping the |
Describe the feature / bug 📝:
When i have a radix-ui dialog open, sonner is above visually but is behind the dialog despite setting the appropriate z-index on all concerned elements. Making swiping/close button inaccessible.
Steps to reproduce the bug 🔁:
And then
Nothing i do, even adding classes makes the Toaster go to the front.
I've tried to do this as-well, no luck.
The text was updated successfully, but these errors were encountered: