jargon

Comparison

Passive event listenervspreventDefault

Passive event listener

the console warned that your scroll handler blocked scrolling, so you marked it passive.

A listener declared with `{ passive: true }`, promising not to call `preventDefault`, which lets the browser start scrolling without waiting to see what the handler does. Without it, every touch and wheel listener adds its own execution time to the delay before the page moves. Browsers now default to passive for touch and wheel listeners on the document, which means a handler that genuinely needs to cancel scrolling has to say `{ passive: false }` explicitly.

Full entry →

preventDefault

you stopped the form from navigating away but the parent's handler still ran.

Cancelling the browser's built-in response to an event — following a link, submitting a form, scrolling on a wheel event — without affecting propagation at all. It is routinely confused with stopping propagation because both are called in the same handler, but they do unrelated things. It has no effect on a non-cancelable event, and none at all on a passive listener.

Full entry →

Related comparisons