question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

event.stopPropagation in custom event handlers doesn't work

See original GitHub issue

Do you want to request a feature or report a bug?

  • I found a bug
  • I want to propose a feature

What is the current behavior? If you have Dropzone which nested into other Dropzone then when you’ll try to upload file to the nested dropzone you’ll also get this file upload to external Dropzone. It should be handled via event.stopPropagation in then nested Dropzone’s onDrop handler. But event.stopPropagation doesn’t prevent propagation of event.

If the current behavior is a bug, please provide the steps to reproduce.

  1. I made a simple demo - you can check it here (https://codepen.io/sumthief/pen/qJqPWO). When you’ll upload to parent area - it’ll console log ‘parent’. But when you’ll upload to child area it’ll console log both ‘children’ and ‘parent’. And it’s not correct behavior because of stopPropagation should prevent event propagation.

What is the expected behavior? event.stopPropagation should stop propagation of the event. Looks like it was broken in https://github.com/react-dropzone/react-dropzone/pull/616 when invocations of custom handlers were wrapped in Promise (looks like it’s too late for stopPropagation invocation).

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Operating System and react-dropzone version. Ubuntu 18.04.1 LTS, Chrome 69.0.3497.100, react-dropzone 5.1.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
okonetcommented, Oct 16, 2018

🎉 This issue has been resolved in version 6.2.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

1reaction
rolandjitsucommented, Oct 15, 2018

@sumthief sorry about that 🙄 Glad it helps though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop propagation doesn't work - Stack Overflow
Propagation of events is between elements; if the user clicks an element directly with a handler directly attached to it, stopping the ...
Read more >
Event.stopPropagation() - Web APIs | MDN
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Read more >
The Dangers of Stopping Event Propagation - CSS-Tricks
It works, but it completely ignores the possibility that any other code on the page might need to know about that event.
Read more >
event.stopPropagation() | jQuery API Documentation
This method works for custom events triggered with trigger() as well. Note that this will not prevent other handlers on the same element...
Read more >
Event Handling - Vue.js
It is a very common need to call event.preventDefault() or event.stopPropagation() inside event handlers. Although we can do this easily inside methods, it ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found