desandro / draggabilly

:point_down: Make that shiz draggable
https://draggabilly.desandro.com
MIT License
3.86k stars 386 forks source link

(Emitted error) Ignored attempt to cancel a touchstart event with cancelable=false, for example because scrolling is in progress and cannot be interrupted. #220

Open Rezyan opened 2 years ago

Rezyan commented 2 years ago

Hi,

When using draggabilly with a mobile device (e.g. with the Chrome DevTools), an error is sometimes emitted in the console, but I have some trouble reproducing it without my app, so i can't show you the steps:

[Intervention] Ignored attempt to cancel a touchstart event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
proto.handlePointerDown @ draggabilly.js:189
proto.emitEvent @ ev-emitter.js:86
proto.emitEvent @ draggabilly.js:120
proto.pointerDown @ unidragger.js:153
proto.ontouchstart @ unidragger.js:120
proto.handleEvent @ unidragger.js:36

3

2

A quick fix could be something like this:

https://github.com/desandro/draggabilly/blob/125258c6f59f0069cd2a50f29e7358de390ccbb8/draggabilly.js#L189-L189

- event.preventDefault();
+ if ( event.cancelable ) event.preventDefault();

Regards

Rezyan commented 1 year ago

Hey @desandro, could you please take a look at this issue and the related PR?