FL3NKEY / scroll-lock

🔨 Cross-browser JavaScript library to disable scrolling page
MIT License
273 stars 37 forks source link

[Intervention] Ignored attempt to cancel a touchmove event #19

Closed raphaelportmann closed 3 years ago

raphaelportmann commented 4 years ago

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

FL3NKEY commented 3 years ago

22

https://www.npmjs.com/package/scroll-lock/v/2.1.5