Back to all posts

Core Web Vitals: what actually moves INP

INP measures how long the page takes to visibly respond after a user clicks, taps or types. A good score is under 200 milliseconds at the 75th percentile. The causes are almost always the same: too much JavaScript running at the wrong moment.

1. Yield before heavy work

Paint the immediate feedback first, then do the expensive part. scheduler.yield() hands control back to the browser so it can render the pressed state before your handler continues.

ts
button.addEventListener("click", async () => {
  button.dataset.loading = "true";   // visible feedback
  await scheduler.yield();           // let the browser paint
  runExpensiveFilter();              // then do the work
});

2. Mark non-urgent React updates

Typing into a search box should update the input instantly, while the filtered list can wait. Wrap the slow update in startTransition or read the value through useDeferredValue.

3. Ship less JavaScript

  • Audit third-party scripts. Chat widgets and tag managers are frequent offenders.
  • Move static UI to Server Components so it never hydrates.
  • Lazy-load anything below the fold that is interactive.

4. Measure in the field

Lab tools miss the slow phones your real users carry. Collect INP with the web-vitals library and look at which interactions are slow, not only the overall score.