vaadin / vaadin-upload

The Web Component for uploading multiple files with progress indication. Part of the Vaadin components.
https://vaadin.com/components
Apache License 2.0
90 stars 63 forks source link

Detect file drop support instead of touch #52

Closed platosha closed 5 years ago

platosha commented 8 years ago

Currently, the drop is disabled on touch devices. However, some devices have both touch support and drop files support (e.g., notebooks with touch screens).

We need to detect if dropping files is not supported and disable drop area depending on that.

platosha commented 8 years ago

I haven't found a way to feature-detect support for dropping files.

This SO thread suggests to detect if HTML5 Drag-and-Drop events together with FileReader API are supported. Tried in with the simulator: iOS 9.3 Safari reports both of them as supported, so this detection wouldn't be correct for iOS, at least.

To improve the current nodrop behaviour, I would suggest to:

tg339 commented 7 years ago

Any updates on this issue? We're facing problems with touch screen windows computers.

rwestlund commented 6 years ago

I think something changed recently in Chrome. document.createEvent("TouchEvent") works on Chrome 67 desktop on a win 10 machine without a touchscreen. Meaning that nodrop will almost always be true.

My current workaround is to force nodrop=false on all platforms. It's mildly frustrating that it can't be set declaratively, as it's a boolean attribute that is defaulting to true :(

A lot has changed in the last two years; maybe there's a better solution now?

web-padawan commented 5 years ago

Closing per https://github.com/vaadin/vaadin-upload/issues/153#issuecomment-462781301 Let's keep that issue open, as it's generally easier to discover by its name.