Concept · No. 043 · November 28, 2026
INP waits for the next paint, so yield before the heavy work
Interaction to Next Paint does not measure how fast your handler runs. It measures how long the user stares at an unchanged screen, which changes where the fix has to go.
The idea
Interaction to Next Paint (INP) is the Core Web Vital that replaced First Input Delay in 2024. For each click, tap or key press, it measures the time from the input until the browser paints the next frame. A page is reported by roughly its worst interaction over the visit, not its average. Google's threshold for good is 200 milliseconds or less.
Each interaction has three parts: - Input delay: the main thread is busy with something else when the event arrives. - Processing time: your event handlers run. - Presentation delay: style, layout and paint for the resulting frame.
The browser cannot paint while JavaScript holds the main thread. So the useful question is not how fast your handler is, but what the user sees first and how much work you do before letting the frame out.
An example
A product listing has a filter checkbox. The change handler does four things synchronously: updates filter state, re-renders a long result list, writes the filter to localStorage, and sends an analytics event.
The checkbox does not visibly toggle until all four finish, because the paint is queued behind them. On a fast laptop this is barely noticeable. On a mid-range phone the user taps, sees nothing, and taps again.
The restructured handler: - Update the checkbox state and show a lightweight pending indicator. - Call await scheduler.yield(), falling back to a setTimeout promise where it is unsupported. The browser can now paint the toggle. - Re-render the list in the continuation. - Move analytics and storage writes into requestIdleCallback or a later task.
Total work is unchanged. The interaction now ends at the first paint, which happens early.
Where it breaks
Yielding does not make work cheaper. If the frame the user needs is the result itself, such as characters appearing in a text field, deferring the work only defers the feedback. That work has to shrink.
Continuations race. Between the yield and the render, the user can click again, and the older continuation may overwrite newer state. Every deferred step needs a check that it is still the latest intent, or an AbortController to cancel it.
Presentation delay is not fixed by JavaScript changes. A very large DOM makes style and layout expensive after any state change. Virtualization or content-visibility addresses that, yielding does not.
Input delay is often caused by code you did not write. A third-party script running a long task when the user taps inflates INP, and splitting your own handler leaves it untouched.
Lab tools mislead. Lighthouse does not interact with the page, so it reports Total Blocking Time as a proxy. A clean lab score says little about the slow interaction a real user hits on a real device.
In practice
I would start from field data, not a profiler session. The web-vitals library's attribution build reports which element was interacted with, the breakdown into the three phases, and the Long Animation Frame entries that overlapped it. That breakdown decides the fix.
- High input delay: find what was running. Audit third-party scripts, chunk startup work, and avoid long tasks during hydration.
- High processing time: paint feedback first, yield, then do the rest. Push non-visual work like logging and persistence out of the handler entirely.
- High presentation delay: reduce DOM size and layout scope before touching JavaScript.
Test on throttled CPU or a real low-end device, because the regression usually only exists there. Treat every handler that does more than update visible state as a candidate for splitting.
In an event handler, paint the feedback the user is waiting for first and yield before any work they are not waiting to see.