Bugfix: improved firefox mobile draggable solution

This commit is contained in:
djmaze 2021-02-24 10:41:24 +01:00
parent ae3bab4b35
commit 0696e20878
3 changed files with 4 additions and 11 deletions

View file

@ -93,7 +93,7 @@
if (dragSource) {
// get ready to start dragging
lastTouch = e;
e.preventDefault(); // prevent scrolling NOTE: this creates a bug that click will not work
// dragSource.style.userSelect = 'none';
// 1000 ms to wait, chrome on android triggers dragstart in 600
holdInterval = setTimeout(() => {
@ -130,10 +130,6 @@
touchend = e => {
if (dragSource) {
if (!isDragging) {
// touched the element but didn't drag, so simulate a click
dispatchEvent(lastTouch, 'click', e.target);
}
// finish dragging
allowDrop && 'touchcancel' !== e.type && dispatchEvent(lastTouch, 'drop', lastTarget);
reset();