Skip to content

Stacked Toast is not 100vw on mobile #1234

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

Open
xaviervalarino opened this issue Apr 16, 2025 · 0 comments
Open

Stacked Toast is not 100vw on mobile #1234

xaviervalarino opened this issue Apr 16, 2025 · 0 comments

Comments

@xaviervalarino
Copy link

xaviervalarino commented Apr 16, 2025

My toasts don't take the full width of the viewport on mobile screens. I noticed this reported in #1187, but I'm still experiencing it in 11.0.5. It looks like this only effects containers that are using the stacked prop.

The container initially has it's width set to 100vw in the breakpoint:

@media only screen and (max-width: 480px) {
    .Toastify__toast-container {
        width: 100vw;
        left: env(safe-area-inset-left);
        margin: 0
    }
   // ...
}

But then later on the container width is set to --toastify-toast-width with higher specificity when it the toasts are stacked. The variable at this scope is still 320px:

.Toastify__toast-container[data-stacked=true] {
    width: var(--toastify-toast-width)
}

My quick fix was to set the variable to 100vw:

@media only screen and (max-width: 480px) {
   .Toastify__toast-container  {
    --toastify-toast-width: 100vw;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant