Would "passive" event listeners help with INP?

105 views
Skip to first unread message

Adam Cable

unread,
Aug 24, 2023, 2:01:55 PM8/24/23
to web-vitals-feedback
It's been advised for quite a few years now to have passive event listeners to help with scrolling (https://developer.chrome.com/en/docs/lighthouse/best-practices/uses-passive-event-listeners/) - but just wondering if this same advice applies to INP?

I.e. if you have some event listeners on buttons that will never stop the default action, will this help? Not sure if this will have any impact.

Thanks,
Adam

Michal Mocny

unread,
Aug 24, 2023, 2:20:24 PM8/24/23
to Adam Cable, web-vitals-feedback
Most event types do not support "passive" dispatch in the way scrolling events do.  Most event handlers, whether passed the passive flag or not, are still going to be called from the same task as all other event handlers, and processing those handlers will block the next paint regardless (and so will affect responsiveness, and will get measured by INP).

For scrolling, what happens is that the browser is actually able to implement default actions, then delay scheduling those JS events in the first place, so users have a smooth scrolling experience which cannot get blocked on main-thread delays.  That is not true for most other (discrete) events, which INP measures.

-Michal

--
You received this message because you are subscribed to the Google Groups "web-vitals-feedback" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-vitals-feed...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web-vitals-feedback/8bd806d2-6822-4c6d-ba24-2437657c92a6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages