Don't open file dialog when default prevented earlier.
See original GitHub issueDo 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.
- Create a
ReactDropzone
, with a button inside. For example, to delete a dropped file (DeleteFileButton
) - Make sure the
onClick
handler ofDeleteFileButton
callsevent.preventDefault()
. - Click this
DeleteFileButton
- 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:
- Created 6 years ago
- Comments:16 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop 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
Top GitHub Comments
This bot is frustrating.
@stalebot, the issue still needs to be resolved.