vue-dndrop icon indicating copy to clipboard operation
vue-dndrop copied to clipboard

Drag works only for first time on mobile (touch) device

Open chicko01 opened this issue 2 years ago • 11 comments

On mobile (or touch) device dragging works only for first time. Then you cannot grab (start dragging). Issue is reproducible for example on https://amendx.github.io/vue-dndrop/examples/drag-handle.html.

Problem is caused by removing (and not adding back) 'touchstart' event after finishing first drag (mouseUp function).

https://github.com/amendx/vue-dndrop/blob/master/src/utils/container/mediator.js#L405 -> https://github.com/amendx/vue-dndrop/blob/master/src/utils/container/mediator.js#L38

chicko01 avatar Mar 03 '23 06:03 chicko01

I have the same issue and tablet, have you solved it? Is there any new information?

marina31714 avatar Mar 20 '23 12:03 marina31714

Hi, Is there any update on this issue? Thank you.

krisdarryn-mrm avatar Apr 05 '23 12:04 krisdarryn-mrm

I have the same issue. Is there any new information? Maybe https://www.uriports.com/blog/easy-fix-for-intervention-ignored-attempt-to-cancel-a-touchmove-event-with-cancelable-false/ can have the solution.

EmanuelCostaa avatar Apr 27 '23 13:04 EmanuelCostaa

I have the same issue. Is there any new information? Maybe https://www.uriports.com/blog/easy-fix-for-intervention-ignored-attempt-to-cancel-a-touchmove-event-with-cancelable-false/ can have the solution.

This one is promising, thank you for sharing.

krisdarryn-mrm avatar Apr 27 '23 13:04 krisdarryn-mrm

Same issue here. Is there any new information?

  1. The function removeGrabListeners () is really necessary?

  2. here in my computer I got this error: image

  3. I think the html scroll has to be disabled so as not to be confused with the drag action.

LucasRosas avatar Apr 28 '23 11:04 LucasRosas

I found a solution!! Not the most elegant, but it worked. 😄

  • I replaced the render functions with setup and had to import { h } from 'vue': image image

Notice that I passed the wrapChild function inside setup(). And since setup takes prop and contect as parameters, I also changed this.$slots.default to context.slots.default().

-(I don't know if it's necessary) I added $context.$emits in the props variable of mapOptions image

Ckeck At that point the problem with the touch on the second element had been fixed! But the components stopped emitting events.

  • I renamed eventEmitterMap keys image

  • Added if(event.cancelable) condition to event.preventDefault() in onMouseMove(event) image

Warning At that point it was only possible to move the Draggable horizontally. Here starts the ugly part:

  • In the Container, in addition to listening to the events, I needed to set their functions via prop: image

  • Finally, I created a function that interrupts the scroll and checks if the clientY of the mousemove and touchmove is a value close to the edges to move the scroll via window.scrollBy(0, +-100) in onDragStart and reverts this status in onDrop. image

I hope this solution helps to write a prettier solution.

LucasRosas avatar Apr 30 '23 18:04 LucasRosas

Many thanks, @novikov-dv , who managed to solve the problem : https://github.com/novikov-dv/vue3-dndrop/blob/master/dist/vue3-dndrop.esm.js

LucasRosas avatar May 05 '23 12:05 LucasRosas

Hi, we're having the same issue on an older vue2 project, any update on when it'll be patched?

Thanks!

CedroVost avatar May 15 '23 19:05 CedroVost

I don't get it. The simple (no tags) sample works on the official page on the touch devices. But if I implement it completely the same way locally it doesn't. After one drag it stops working.

Hlautameki avatar Sep 14 '23 19:09 Hlautameki

import { Container, Draggable } from https://github.com/novikov-dv/vue3-dndrop/blob/master/dist/vue3-dndrop.esm.js if you use vue3. It worked for me, @Hlautameki.

LucasRosas avatar Sep 14 '23 20:09 LucasRosas

@LucasRosas Amazing. It works. Thank you very much. You've saved me a lot of time. Especially since this library was my last hope for available drag-and-drop solutions for Vue :)

Hlautameki avatar Sep 15 '23 16:09 Hlautameki