The three phases of every interaction
- Input delay: waiting for the main thread to be free to run the handler.
- Processing time: executing the event handler code.
- Presentation delay: recalculating layout and painting the next frame.
How to improve INP
The key is unblocking the main thread: breaking up long tasks (yielding), reducing and deferring JavaScript, avoiding unnecessary re-renders, and limiting expensive DOM operations inside event handlers.
Example
Educational example: show progress and yield between chunks. scheduler.yield() or a setTimeout fallback creates an opportunity for other tasks; awaiting requestAnimationFrame alone does not ensure a paint. Profile chunk sizes and handle errors and repeated clicks. Fast visual feedback does not mean the whole asynchronous operation is finished.
button.addEventListener('click', () => {
for (let i = 0; i < items.length; i++) {
processItem(items[i]); // blocks the main thread
}
updateUI();
});const yieldTask = () => globalThis.scheduler?.yield
? globalThis.scheduler.yield()
: new Promise(resolve => setTimeout(resolve, 0));
button.addEventListener('click', async () => {
button.disabled = true;
status.textContent = 'Processing…';
try {
await yieldTask();
for (let i = 0; i < items.length; i += 100) {
for (const item of items.slice(i, i + 100)) processItem(item);
await yieldTask();
}
updateUI();
status.textContent = 'Done';
} catch {
status.textContent = 'The operation could not be completed';
} finally {
button.disabled = false;
}
});200 milliseconds or less is good, 200–500 ms needs improvement, and over 500 ms is poor. As with the other Core Web Vitals, the threshold applies to the 75th percentile.
FID measured input delay for the first interaction. INP covers input delay, event processing and time to the next paint for clicks, taps and keyboard interactions during a visit. It does not measure time until an entire network operation finishes.
It covers clicks, taps and keyboard interactions, not hover or scrolling. It reports a near-worst interaction, excluding some outliers when there are many interactions. No eligible interaction means no INP value.
Long tasks blocking the main thread: heavy event handlers, layout thrashing from reading and writing styles in a loop, and large JavaScript bundles executed in response to a click. Breaking work into smaller tasks and yielding to the main thread is what helps.