🔍 inp.works

Main thread blocked: high input delay before your handler even runs

What is happening

Input delay is the time between the user's click and the moment your event handler starts. The handler itself can be perfectly fast — but if the main thread is in the middle of a long task (hydration, analytics init, a timer parsing data), the event waits in the queue until that task finishes.

This is the only INP phase your handler can't fix, because the culprit is some other code that happened to be running.

How to recognise it

How to fix it

Problem

// at page load: one 800 ms task — every click during it waits
initAnalytics()
buildSearchIndex(allProducts)
prefetchRecommendations()

Fix

initAnalytics()
await scheduler.yield()                  // events can run between steps
buildSearchIndex(allProducts)
requestIdleCallback(() => prefetchRecommendations())
Scan your site for free →
Advertise here