ProgerXP / FileDrop

Self-contained cross-browser pure JavaScript class for Drag & Drop and AJAX (multi) file upload.
filedropjs.org
The Unlicense
264 stars 61 forks source link

fullDocDragDetect: true behaviour #35

Open danielocdh opened 9 years ago

danielocdh commented 9 years ago

when fullDocDragDetect is set to true, I was expecting that I could drag my file to any place in the document and it would upload, but instead the browser opens the file.

you can see this happening with chrome (which defaults to fullDocDragDetect: true) on the example here: http://filedropjs.org/#reacting

If that's how it is supposed to work, then the css is not consistent, because the "over" class gets added to "fd-zone" container even when the file won't be uploaded.

ProgerXP commented 9 years ago

Explanation of this option is probably misleading. I doubt it's possible to get Chrome (or other browser) handle drop event on the entire document, i.e. outside of the drop zone boundaries - imagine if you have several drop zones, which one is supposed to respond to the event? All? That would be a mess.

So the real meaning of fullDocDragDetect is to trigger when drag-over event occurs for FileDrop - when user hovers the item over drop zone boundaries or when anywhere in the document. Regardless of the setting's value, upload event will always happen if user drops the file precisely inside the zone.

One use case I can think of is when you want your drop zone to be more standing out as soon as the user starts dragging an object over the document (this is how Gmail works, for example). If you want to create document-wise drop zone that will accept files anywhere on the screen - just make a position: fixed with high z-index div that will take up the entire window space.