e.stopPropagation() seems to not be working as expect.
See original GitHub issueI 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:
var Search = React.createClass({
handleClick: function(e) {
e.stopPropagation();
},
render: function() {
return <input onClick={this.handleClick} />
}
});
document.addEventListener('click', function() {
console.log('propagation')
}, false);
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?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
e.stopPropagation() is not working as expected?
live() method handles events once they have propagated to the top of the document, it is not possible to stop propagation of live...
Read more >The Dangers of Stopping Event Propagation - CSS-Tricks
This bug happens because the Bootstrap code responsible for closing the dropdown menu is listening for click events on the document. But since ......
Read more >Bubbling and capturing - The Modern JavaScript Tutorial
The method for it is event.stopPropagation() . For instance, here body.onclick doesn't work if you click on <button> :.
Read more >event.stopPropagation() | jQuery API Documentation
Description: Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. version added: 1.0event....
Read more >Stoppropagation react typescript. preventDefault)를써도이벤트...
</button> event. typescript react function coponent props. Please note that I'll keep using yarn ... stopPropagation () seems to not be working as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
a workaround, use
window.addEventListener()
to replacedocument.addEventListener
,event.stopPropagation()
can stop event propagate to window.We’re fixing this in React 17.