Interaction to Next Paint (INP) is the Core Web Vital that measures responsiveness: how long a page takes to visibly respond after someone clicks, taps or presses a key. Google rates INP as good at 200 milliseconds or less and poor above 500 milliseconds, measured at the 75th percentile of real visits. Astro sites start with an advantage because they ship little JavaScript, but heavy islands, early hydration and third-party scripts can still push INP into the red.
This explainer covers what Interaction to Next Paint measures, why it replaced FID, where Astro sites lose INP, and how to measure and fix it.
Key Takeaways
- INP is the slowest (roughly worst) interaction delay a visitor experiences on a page, from input to the next paint.
- Good is 200 ms or less; needs improvement is up to 500 ms; poor is above 500 ms.
- Every interaction has three phases: input delay, processing time and presentation delay.
- On Astro sites, the usual causes are islands hydrating with
client:load, long event handlers and third-party scripts.- Measure with real-user data (Search Console, CrUX, the
web-vitalslibrary), then fix with lazier hydration and smaller tasks.
What Interaction to Next Paint measures
INP observes every click, tap and key press during a visit. For each one, it measures the time from the input until the browser paints the next frame, which is the moment the visitor sees something change. At the end of the visit, the page’s INP is the longest of those interactions (on pages with very many interactions, a high outlier is ignored so one fluke doesn’t define the score).
Each interaction breaks into three parts:
| Phase | What happens | Typical cause of delay |
|---|---|---|
| Input delay | The event waits for the main thread to be free | Other JavaScript running: hydration, analytics, timers |
| Processing time | Your event handlers run | Slow or heavy handler code |
| Presentation delay | The browser recalculates styles, lays out and paints | Large DOM updates, expensive CSS, layout thrashing |
Scrolling and hovering aren’t counted. Only discrete interactions (pointer, tap, keyboard) are.
Why INP replaced First Input Delay
INP became a Core Web Vital in March 2024, replacing First Input Delay (FID). FID only measured the input delay of the first interaction, ignoring how long handlers took and everything after the first click. Most sites passed FID easily. INP is stricter and more representative: it covers the whole visit and all three phases, so a page that responds slowly to its third click, or whose menu takes 400 ms to render, now shows up in the data.
Core Web Vitals are part of Google’s page experience signals, and they’re also a good proxy for whether a site feels fast. The Core Web Vitals guide covers LCP and CLS alongside INP.
Why Astro sites usually start with good INP
The main thread is free most of the time on a typical Astro page, because:
- Astro components render to HTML with no client JavaScript.
- Islands hydrate independently, so one interactive component doesn’t require hydrating the whole page.
- Processed
<script>tags are modules, which are deferred and don’t block parsing.
Compare that with a single-page app that hydrates the entire component tree on load: until hydration finishes, every click waits. The MPA vs SPA explainer covers that difference. But “less JavaScript” doesn’t mean “no INP problems.” These are the patterns that cause them.
Where Astro sites lose INP
Hydrating islands too early
client:load hydrates an island as soon as the page loads. If several large islands hydrate at once, the main thread is busy for hundreds of milliseconds, and any click during that window waits. That’s input delay.
---
// src/pages/index.astro
import ProductFilter from '../components/ProductFilter.jsx';
import Reviews from '../components/Reviews.jsx';
import Newsletter from '../components/Newsletter.jsx';
---
<!-- Before: all three compete for the main thread on load -->
<ProductFilter client:load />
<Reviews client:load />
<Newsletter client:load />
<!-- After: only the above-the-fold control hydrates early -->
<ProductFilter client:load />
<Reviews client:visible />
<Newsletter client:idle />
client:visible waits until the island scrolls into view, and client:idle waits until the browser is idle. Both spread hydration out so it doesn’t block early clicks. The client directive guide and the lazy-load islands tip go deeper.
Using a framework island for a small interaction
A React component for a menu toggle ships React’s runtime and hydrates it, just to flip a class. A plain <script> in an Astro component does the same work with a fraction of the JavaScript and no hydration cost. The island or script guide helps you choose.
Long event handlers
Processing time grows when a handler does a lot of work at once: filtering a large list, sorting, formatting, or updating many elements. Break the work up so the browser can paint between chunks:
// src/lib/yield.ts
export function yieldToMain(): Promise<void> {
if ('scheduler' in globalThis && 'yield' in (globalThis as any).scheduler) {
return (globalThis as any).scheduler.yield();
}
return new Promise((resolve) => setTimeout(resolve, 0));
}
---
// src/components/FilterList.astro
---
<button class="filter">Show in-stock only</button>
<ul class="products"><slot /></ul>
<script>
import { yieldToMain } from '../lib/yield';
document.querySelector('.filter')?.addEventListener('click', async (event) => {
const button = event.currentTarget as HTMLButtonElement;
button.setAttribute('aria-pressed', 'true');
await yieldToMain();
document.querySelectorAll<HTMLLIElement>('.products li').forEach((item) => {
item.hidden = item.dataset.stock === '0';
});
});
</script>
The button’s pressed state paints immediately, which ends the interaction for INP purposes, and the heavier list update runs after. scheduler.yield() is available in Chromium-based browsers; the setTimeout fallback works everywhere.
Third-party scripts
Analytics, chat widgets, A/B testing tools and tag managers run on the main thread and compete with your handlers. Load them late, remove the ones you don’t use, and consider moving them off the main thread. The Partytown guide shows how to run third-party scripts in a web worker, and the privacy-friendly analytics tip covers lightweight alternatives.
Large DOM updates
Presentation delay grows with how much the browser must re-layout. Rendering hundreds of new elements, toggling classes on <body> that restyle the whole page, or reading layout (offsetHeight) between writes all slow the next paint. Keep updates local, and use CSS content-visibility: auto on long off-screen sections.
Client-side navigation
With <ClientRouter />, a link click fetches and swaps the next page. Scripts that re-run on astro:page-load and heavy transition animations add to that interaction. Keep page-load scripts light, and use prefetching so the HTML is already there.
How to measure INP
Field data first. INP depends on real devices and real behavior, so lab tools only approximate it.
- Google Search Console reports Core Web Vitals, including INP, for URL groups based on Chrome user data.
- PageSpeed Insights shows the Chrome UX Report (CrUX) INP for a URL or origin, if there’s enough traffic.
- Your own real-user monitoring with the
web-vitalslibrary gives you per-interaction detail:
---
// src/components/WebVitals.astro
---
<script>
import { onINP } from 'web-vitals/attribution';
onINP(({ value, rating, attribution }) => {
navigator.sendBeacon('/api/vitals', JSON.stringify({
metric: 'INP',
value,
rating,
target: attribution.interactionTarget,
inputDelay: attribution.inputDelay,
processingDuration: attribution.processingDuration,
presentationDelay: attribution.presentationDelay,
}));
});
</script>
Install it with npm install web-vitals. The attribution build tells you which element was interacted with and which phase was slow, which points straight at the fix. Send the data to any endpoint or analytics tool that accepts custom events.
Lab debugging second. In Chrome DevTools, the Performance panel shows live INP as you interact, and a recorded trace shows the long tasks behind a slow interaction. Throttle the CPU to simulate a mid-range phone; a fast laptop hides most INP problems. Lighthouse reports Total Blocking Time, which correlates with input delay during load.
An INP checklist for Astro sites
- Hydrate with
client:visibleorclient:idleunless the island is needed immediately. - Replace framework islands with plain scripts for simple toggles, tabs and menus.
- Give visual feedback first, then do heavy work after yielding to the main thread.
- Audit third-party scripts: remove, defer, or move them to a worker.
- Keep DOM updates small and avoid forced synchronous layout.
- Check the bundle size analysis tip to find oversized islands.
- Monitor INP from real users, segmented by page type and device.
Komal themes build their menus, tabs and accordions with small Astro scripts rather than framework islands, which keeps the main thread quiet on load; you can test any Astro theme preview in DevTools with CPU throttling to see this. Google’s INP documentation on web.dev is the definitive reference for the metric.
FAQ
What is a good Interaction to Next Paint score?
200 milliseconds or less at the 75th percentile of page visits is good. Between 200 and 500 milliseconds needs improvement, and above 500 milliseconds is poor.
What is the difference between INP and FID?
FID measured only the input delay of a visitor’s first interaction. INP measures the full time to the next paint for all interactions during a visit and reports one of the slowest, so it captures slow handlers and rendering too. INP replaced FID as a Core Web Vital in March 2024.
Does Astro improve INP?
Astro helps because it ships no JavaScript by default and hydrates islands independently, so the main thread is usually free. INP can still be poor if islands hydrate eagerly, handlers do heavy work, or third-party scripts block the main thread.
How do I find which interaction is slow?
Use the attribution build of the web-vitals library in production to record the interaction target and the slow phase. Then reproduce it in the Chrome DevTools Performance panel with CPU throttling to see the long task responsible.
Does client:load hurt INP?
It can. client:load hydrates as soon as the page loads, and if several islands do that at once, clicks during hydration wait. Use client:visible or client:idle for islands that aren’t needed immediately.