FL3NKEY/scroll-lock

[Intervention] Ignored attempt to cancel a touchmove event

Closed this issue · 1 comments

In some cases trying to cancel an event will fail with following error message:
[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.

It happens because the event is not cancelable. To fix this, check for e.cancelable before e.preventDefault(); in the following two locations:
https://github.com/FL3NKEY/scroll-lock/blob/master/src/scroll-lock.js#L440
https://github.com/FL3NKEY/scroll-lock/blob/master/src/scroll-lock.js#L447

if(e.cancelable) {
    e.preventDefault();
}

image