Comments (8)
This is strange. I have a Surface with a regular touch screen, and the sample works for me:
http://bernardo-castilho.github.io/DragDropTouch/demo/index.htm
In fact, the polyfill is not even needed in that case. The browser supports HTML5 drag/drop events by default.
I do like the Pointer events, and hope all browsers will support them soon, including drag/drop events.
When that happens, the world will be a better place, with cleaner and more standard code, and fewer polyfills ;-)
from dragdroptouch.
It seems Google has dropped support of ontouch API in chrome release 70 www.chromestatus.com/feature/4764225348042752). This polyfill does not work anymore on touch enabled windows tablets with newer Chrome versions. As a workaround I would propose to change the check whether touch is available in this way: if (window.PointerEvent || 'ontouchstart' in document)
.
This works for me but it is still not perfect because it doesn´t solve the issue in Edge.
from dragdroptouch.
Thanks for bringing this up. Fortunately, IE and Edge do support touch-based drag and drop on devices with touch screens, so the polyfill is not needed there.
from dragdroptouch.
@Bernardo-Castilho I have a Surface Book and your demo page doesn't work on IE11 or Edge using the touch screen. This is because IE11/Edge doesn't support the touch events API, it only supports the pointer events API.
Your demo does work in Chrome on my Surface Book because Chrome supports both touch & pointer events.
Firefox is soon to enable their PointerEvents API implementation which will mean that all 4 major browsers on Windows have native Pointer Events support leaving only Safari iOS & Chrome Android that don't and there's a solid polyfill for those. I think the best way forward to support touch will be to use Pointer Events.
from dragdroptouch.
FWIW, I just tried this repo's demo page on IE 11 on a touch-enabled Windows laptop. The drag and drop works when using the touchpad, but not when attempting to drag and drop by interacting with the draggable elements via touching the screen.
from dragdroptouch.
I can confirm what @gnapse said, the demo page does not work in IE11 or Edge.
So I did some more testing of desktop setups with your demo and the demo with just the HTML 5 events (the native version, the one you used as a basis) and my own project where I only used the native events for now and I'm now trying to make compatible with more browsers, there are two things I noticed:
-
The native version does not work in Edge (dragging does but drop has no effect) either but it does work in my own project.
-
The native version using mouse (or touchpad/trackpoint) does not work on IE11 (!). And in my own project dragging seems to work but not dropping (perhaps it has something to do with the code for making sure that the right stuff is being dragged into it).
(Newest IE11 and Edge on Win 10 with Creators Update on a touch-enabled device BTW.)
Apart from that it enables touch drag&drop in Chrome on Linux/Windows and Firefox on Windows where it previously wouldn't work with just native events (native with Firefox on Linux works when some requirements are met [GTK3, multi-process] which was the case for me).
from dragdroptouch.
Did you try using navigator.maxTouchPoints as the article suggested?
BTW, most Edge issues should go away soon. I've been using the new Chromium-based version and it's great! ;-)
from dragdroptouch.
navigator.maxTouchPoints
standalone does not work in Firefox66.
On mobile devices the polyfill works parallel to the native browser implementation. Shorttouch activates the polyfill, longtouch activates the native implementation.
The best solution would be to find a way to disable this polyfill on mobile devices and using their own native browser implementations. E.g. if (window.orientation == undefined )
could solve this issue but it is deprecated and I don´t know how it works on chromebook tabs.
from dragdroptouch.
Related Issues (20)
- Drag-Drop-Touch-Polyfill not working with React Grid Layout library HOT 5
- NPM package outdated HOT 3
- Image is not draggable on Canvas. HOT 7
- Script breaks with this code HOT 2
- The returned event does not have offsetX and offsetY property HOT 5
- dblclick event triggered twice on touch screens HOT 1
- Internal selections is not working HOT 9
- How to drag&drop from window A to window B in Android? HOT 10
- Breaks Bootstrap 3 dropdown menu HOT 2
- Is it possible to make this a default behaviour on desktop as well?
- Enabling the polyfill only when draggable attribute is set HOT 1
- Demo page doesn't work, and uses a "dead" copy of wijmo
- Contributing changes HOT 8
- update the npm package HOT 3
- Set up github pages for the master branch HOT 10
- Playwright install in postinstall HOT 2
- Refine the demo page
- Should not start touch-dragging when source element has draggable="false" HOT 8
- tried to tweak the `options` of your new version, not working though HOT 30
- add DEBUG to the source HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dragdroptouch.