Closed platosha closed 5 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:
userAgent
detection for platforms which are known to support both touch and files drop (e.g, MS Windows), enabling back the dropping for them.nodrop
purely visual. Leave the dropping functionality enabled even if detected a touch device.Any updates on this issue? We're facing problems with touch screen windows computers.
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?
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.
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.