Skip to content

Close button overlays toast text #1204

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
cduff opened this issue Jan 15, 2025 · 3 comments
Open

Close button overlays toast text #1204

cduff opened this issue Jan 15, 2025 · 3 comments

Comments

@cduff
Copy link

cduff commented Jan 15, 2025

For example:

image

Since v11 the close button is absolutely positioned. However, with its default position and with the default toast padding, it's possible for the close button to overlay toast text. This didn't happen <v11.

Should the default styling avoid this?

@fkhadra
Copy link
Owner

fkhadra commented Jan 15, 2025

Hey @cduff, I couldn't reproduce it, normally the content has a padding to avoid that. Could it be that you have some custom css rules applied? May I ask you to reproduce the issue on stackblitz? Thank you
Screenshot 2025-01-15 at 08 18 39

@cduff
Copy link
Author

cduff commented Jan 16, 2025

Hey @cduff, I couldn't reproduce it, normally the content has a padding to avoid that. Could it be that you have some custom css rules applied? May I ask you to reproduce the issue on stackblitz? Thank you Screenshot 2025-01-15 at 08 18 39

Hi @fkhadra, thanks for your response on this.

Try this StackBlitz:

https://stackblitz.com/edit/vitejs-vite-rhrg1ybn?file=src%2FApp.tsx

Image

@Link2Twenty
Copy link

Looks like the padding is 14px

padding: var(--toastify-toast-padding);

But the button is 20px wide and 25px tall (3px come from the line-height)

top: 6px;
right: 6px;

height: 16px;
width: 14px;

I would probably update the SVG so it's square

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
  <path d="m9.48 8 3.75 3.75-1.48 1.48L8 9.48l-3.75 3.75-1.48-1.48L6.52 8 2.77 4.25l1.48-1.48L8 6.52l3.75-3.75 1.48 1.48L9.48 8z"/>
</svg>

Set the height and width of the SVG to 14px.
Update the button's line-height to 0;
and update the --toastify-toast-padding to 16px.

Then the toast will look like this

new padding toast

The extra s' were added to get as close to the close button as I could.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants