Menu

Your preventDefault() Did Nothing, and the Only Warning Went to a Phone You Do Not Have
📰

Your preventDefault() Did Nothing, and the Only Warning Went to a Phone You Do Not Have

DEV Community: mobile·Vladimir Elchinov·13 days ago
#gluokffC
#devtomobile#devto#dev#passive#document
Reading 0:00
15s threshold

The report says the page scrolled while they were dragging the slider. Or that pull-to-refresh fired in the middle of a swipe. Or that the carousel moved and the page moved with it.

You open the handler and it is right there, the line that is supposed to stop exactly this:

document . addEventListener ( " touchmove " , ( e ) => { e . preventDefault () drag ( e ) })

Enter fullscreen mode

Exit fullscreen mode

It is being ignored. Not failing, not throwing, not running late. Ignored, by the specification, and the only notice anybody gets is a console warning on a device you do not have in front of you.

The rule, in the DOM Standard's own words

Every listener has a passive flag, and if you do not set one the browser picks for you.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.