preventDefault ontouchmove does not work on Safari on iOS 12

Viewed 389

I am trying to prevent scroll on iOS using javascript. I found on a few threads that doing like so should work :

document.addEventListener('touchmove', function(e) {
    e.preventDefault();
}, { passive: false });

However, the behaviour is quite random as it does not always work. At first it does nothing, and then after a while for some reasons (not doing anything particular javascript wise, just scrolling) scroll gets effectively prevented.

Is it a bug from webkit on iOS ? Thanks a lot.

0 Answers
Related