Skip to content
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

Positioning wrapper div gets no pointer events #32

Merged
merged 1 commit into from
Feb 2, 2021

Conversation

Kilian
Copy link
Contributor

@Kilian Kilian commented Jan 26, 2021

I need toasts to have a specific offset from their position, and can do that with a custom style that sets the translate CSS property. However because the wrapper div gets pointer events and sits at the original position, it "eats" pointer events.

This PR removes pointer events from the wrapper and then reinstates them on the div itself, so no functionality is lost.

@vercel
Copy link

vercel bot commented Jan 26, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/timo/react-hot-toast/19lsxin01
✅ Preview: https://react-hot-toast-git-fork-kilian-patch-2.timo1.vercel.app

@timolins
Copy link
Owner

Thanks! Not sure why pointer-events was only applied for the center position. That makes me think if it is needed in general. I'll do some testing.

About the positioning, the easiest way to increase the offset is to apply a margin, no need to transform. :)
I think we should mention that in the docs somewhere, since this is a not-so-rare use-case, and the solution isn't quite obvious.

@Kilian
Copy link
Contributor Author

Kilian commented Jan 26, 2021

I like using the individual transform property translate since it's less likely to interfere with other properties like margin (not so much an issue when every toast has fixed position, but can be unpredictable with other configurations), and it plays nice with the "transform" you use as well.

@timolins timolins merged commit 67bdc5b into timolins:main Feb 2, 2021
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

Successfully merging this pull request may close these issues.

2 participants