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

stopPropagation() not working #6

Open
sneridagh opened this issue Apr 16, 2021 · 3 comments
Open

stopPropagation() not working #6

sneridagh opened this issue Apr 16, 2021 · 3 comments

Comments

@sneridagh
Copy link
Contributor

sneridagh commented Apr 16, 2021

Hi!
I have an edge case, where I click from a mounted element that immediately gets unmounted, then the listener handler can't see it "contained" inside the reference object, then it catches it as a "click outside". I tried to use a stopPropagation() but I stumbled upon the same limitation explained in this post:

https://dev.to/dvnrsn/why-isn-t-event-stoppropagation-working-1bnm

so the React synthetic events are attached to window, not to document, then the stopPropagation does not work :(

I already tried it out and attaching the listener to window instead of document works fine. Do you think it's worth to add it to the library? (maybe even as an option?) I can make a PR.

@sneridagh
Copy link
Contributor Author

@zhaluza
Copy link
Owner

zhaluza commented Apr 18, 2021

@sneridagh Thanks for bringing this edge case to my attention - any chance you could post a sandbox link with a simple version of the issue you're facing (with or without the solution you linked)?

@hasanulhaquebanna
Copy link

@zhaluza I am facing also stopPropagation() problem so i had to add this and the package works then fine. I think this issue is happening with React 18 version. Please check this problem.
Again after installing the package it was not working properly that supposed do, but when I add stopPropagation() then works fine.
Thanks.

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

3 participants