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

Cannot prevent event bubbling from child to parent #1967

Closed
xiaowl opened this issue Jul 31, 2014 · 2 comments
Closed

Cannot prevent event bubbling from child to parent #1967

xiaowl opened this issue Jul 31, 2014 · 2 comments

Comments

@xiaowl
Copy link

xiaowl commented Jul 31, 2014

Here is a live demo to show this bug: http://jsfiddle.net/DA2je/

In brief, I have a parent component which has a button, when the button is clicked, a dynamic rendered component will be mounted to a child element of parent. Both parent and newly mounted child have their own onClick handler. In this case, when click on child node, the click event will be handled by both child and parent, even there is e.stopPropagation() in the child event handler.

@syranide
Copy link
Contributor

I imagine it's because of the way React binds event handlers to the document. React provides an overloaded stopPropagation for its own synthetic event dispatcher which correctly stops propagation, but it most likely does not take separate mount roots into consideration.

Another argument for binding event handlers to mount roots perhaps, @chenglou ?

@sophiebits
Copy link
Collaborator

Thanks, this is a dupe of #1691.

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