Suggestion: Option to prevent dragging and dropping elements on the page onto the dropzone
See original GitHub issueIn the meantime, here is my solution for doing this:
onDragEnter={function( event ) {
const dt = event.dataTransfer;
if ( !(
dt.types &&
( dt.types.indexOf ? dt.types.indexOf( "Files" ) !== -1 : dt.types.contains( "Files" ) )
) ) {
this.setState( { isDragActive: false } );
}
}}
onDrop={files => {
if ( files.length === 0 ) {
return;
}
// handle files dropped here
}}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:9
- Comments:28 (3 by maintainers)
Top Results From Across the Web
Prevent browser from loading a drag-and-dropped file
Using the following code (based on @digital-plane's answer) the page becomes a drag target, it prevents object embeds from capturing the events and...
Read more >HTML Drag and Drop API - W3Schools
In HTML, any element can be dragged and dropped. ... Drag the W3Schools image into the rectangle. Drag and Drop. Drag and drop...
Read more >Drag'n'Drop with mouse events - The Modern JavaScript Tutorial
Drag'n'Drop is a great interface solution. Taking something and dragging and dropping it is a clear and simple way to do many things, ......
Read more >Moodle 2.3 :: how to disable the dragging and dropping of files
I have eliminated drag and drop to course page by customizing course/dndupload.js (making function upload_file return false inmediatly), but thsi hack affects ...
Read more >Confluence disable the drag and drop attachment into a page ...
provide a smaller drop zone instead of the full page; at least disable drops that origin from that very page. To highlight my...
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 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

Well one part of the problem is this: The preview creation (
window.URL.createObjectURL(file)) is done on all files, regardless whether they are accepted or not. Shouldn’t previews only be created for accepted files?This issue has been automatically marked as stale because it has not had recent activity in the past 60 days. It will be closed if no further activity occurs. If the problem persists please comment here to bump your issue. Thank You - React Dropzone Maintaners