Passive Event Listeners and Scroll Performance
The passive option for addEventListener that tells the browser a handler won't call preventDefault, letting scrolling proceed immediately without waiting.
The passive option for addEventListener is a small but meaningfully impactful performance optimization specifically for scroll-related events (touchstart, touchmove, and wheel in particular), addressing a subtle problem: by default, the browser can't know in advance whether an event handler is going to call preventDefault() to cancel the event's default action (like scrolling), so it has to wait for the handler to finish running before it can safely proceed with that default action — even if the handler never actually calls preventDefault() at all.
A passive listener is like telling a security guard in advance 'I'm just here to observe, I promise not to stop anyone' — the guard (browser) can let foot traffic (scrolling) continue flowing immediately without pausing to watch what you do, instead of the default assumption that any observer might suddenly step in front of someone and needs to be watched closely before traffic can proceed.