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.

Don't open file dialog when default prevented earlier.

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? When clicking a button inside a dropzone that “prevented the default behavior”, the dropzone still handles the click.

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

  1. Create a ReactDropzone, with a button inside. For example, to delete a dropped file (DeleteFileButton)
  2. Make sure the onClick handler of DeleteFileButton calls event.preventDefault().
  3. Click this DeleteFileButton
  4. The Open File Dialog is shown.

What is the expected behavior? When calling event.preventDefault() inside the onClick handler of the DeleteFileButton, the onClick handler of ReactDropzone shouldn’t do anything. This can be achieved by:

onClick(evt) {
  if (evt.isDefaultPrevented()) {
    return;
  }

  // rest of onClick handler.
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
smeijercommented, Sep 17, 2018

This bot is frustrating.

2reactions
smeijercommented, Mar 19, 2018

@stalebot, the issue still needs to be resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to prevent file dialog from appearing? Why?
Soufiane's code requires that you have a Javascript library called jQuery on your page. If you don't have it, you can get it...
Read more >
Remove Defaults from Common Open File Dialog - TechNet
I need some way to either prevent access to the folder or preferrably just hide the link in the "Common Open File Dialog"....
Read more >
Do not always ask before opening this type of file
There is an option which says “Always ask before opening this type of file” which I want to turn off but I can't...
Read more >
How to correctly use preventDefault(), stopPropagation(), or ...
preventDefault(). Prevents the browsers default behaviour (such as opening a link), but does not stop the event from bubbling up the DOM.
Read more >
Manage file types and download actions in Firefox
If you select Always Open Similar Files in the Downloads panel right-click ... other than the system default are listed, this opens a...
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