-
Notifications
You must be signed in to change notification settings - Fork 47k
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
e.stopPropagation() seems to not be working as expect. #4335
Comments
React (currently) uses a listener on the document for (almost) all events, so by the time your component receives the event it has already bubbled all the way up to the document and stopping it only stops it from synthetically bubbling up through the React hierarchy. Related #2050 |
got it, many thanks :) |
You can reproduce this issue in the following jsbin: |
Current React implementation is attaching events to `document` level. This is breaking bubbling DOM behaviour not letting users to play properly with methods like `stopPropagtion`. Also attaching events to containers instead of `document` integrates better with other Javascript frameworks. With this change we start attaching events at container level. Fixes: facebook#2043 facebook#4335
Current React implementation is attaching events to `document` level. This is breaking bubbling DOM behaviour not letting users to play properly with methods like `stopPropagtion`. Also attaching events to containers instead of `document` integrates better with other Javascript frameworks. With this change we start attaching events at container level. Fixes: facebook#2043 facebook#4335
Current React implementation is attaching events to `document` level. This is breaking bubbling DOM behaviour not letting users to play properly with methods like `stopPropagtion`. Also attaching events to containers instead of `document` integrates better with other Javascript frameworks. With this change we start attaching events at container level. Fixes: facebook#2043 facebook#4335
Current React implementation is attaching events to `document` level. This is breaking bubbling DOM behaviour not letting users to play properly with methods like `stopPropagation`. Also attaching events to containers instead of `document` integrates better with other Javascript frameworks. With this change we start attaching events at container level. Fixes: facebook#2043 facebook#4335
a workaround, use |
@baurine You saved my life! |
The change to "window" did not help me, at least when click happened outside of the initial component |
We're fixing this in React 17. |
If you want to try it: |
I found this issue when I attempted to integrate ReacJs and a jQuery widget.
I bind an click event on input element and document like follow:
And everytime I click the input element, chrome devtool logs 'propagation' message. Should not document element can not receive click event? I'm confused, Did I miss something?
The text was updated successfully, but these errors were encountered: