Single-page applications are seductive from a product perspective: fast route transitions, shared state, and a clean API boundary.
Interaction to Next Paint has a way of exposing architecture debt that lab scores can hide. A template can pass Lighthouse with a respectable LCP and still feel sticky in the field because the main thread is saturated by hydration, third-party tags, and event handlers that do more work than the interaction warrants. The useful mental model is a queue: every tap or keypress creates an input event, and the browser cannot paint the next frame until the main thread reaches a break. INP measures the worst-case latency between those events and the next paint, so a single expensive handler can drag the metric down even if most interactions are fast.
Start with attribution rather than guesswork. Use field data segmented by device class, connection type, and template. Then pair that with the Event Timing API and Long Animation Frames to find the specific interaction targets and scripts responsible. The performance entry for an event includes processing start and processing end, which separates input delay from handler duration. If input delay dominates, the main thread was already busy when the user acted. If processing time dominates, the handler or its synchronous dependencies are the problem. If presentation delay dominates, rendering and style recalculation deserve scrutiny. That distinction changes the fix: yielding and scheduling help the first case, handler decomposition helps the second, and DOM or CSS simplification helps the third.
Hydration is a common culprit in component-heavy templates. A page may look interactive while the framework is still attaching listeners and reconciling state. During that window, clicks either wait or trigger fallback behavior. Reduce the surface area by hydrating only interactive islands, deferring below-the-fold widgets, and avoiding client-side rendering for content that does not need it. Where full hydration is unavoidable, break work into smaller tasks and yield to the browser between chunks. Scheduler.yield, when available, is preferable to arbitrary timeouts because it preserves task priority and lets input run. For older browsers, a message-channel-based yielding pattern is more reliable than setTimeout.
Event handlers deserve the same discipline as network requests. Passive listeners for scroll and touch reduce blocking, but they are not a license to run layout reads on every event. Batch reads and writes, cache measurements, and debounce work that does not need to happen at pointer speed. For search, filters, and form validation, separate the immediate visual acknowledgement from the expensive computation. Paint a pending state, then schedule the query or validation after the next frame. If a handler must parse JSON or transform a large array, move that work to a worker and post back a compact result. Keep the main-thread handler focused on state transitions and DOM updates that are actually visible.
Third-party tags are the wild card. A tag manager can inject chat widgets, heatmaps, A/B testing libraries, and consent tooling that compete for the same main thread. Audit by template and consent state, not just by page. A tag that is idle on article pages may run heavy mutation observers on product pages. Use performance marks around tag initialization, test with tags blocked, and prefer async loading and server-side or edge-side integrations where they reduce client work. Consent mode complicates timing because some tags initialize later, so measure the post-consent interaction path as its own scenario.
Rendering cost is part of INP. Large DOM trees, complex selectors, and layout-triggering animations make every paint more expensive. Avoid forced synchronous layout inside interaction handlers. Use content-visibility for offscreen sections where it fits, contain layout and paint for isolated widgets, and keep animations on transform and opacity. Font swaps and late-loading UI can also shift targets under the pointer, which feels like lag even when the handler is fast.
Finally, treat INP as a regression budget. Add synthetic interaction tests for critical flows, but validate with field data because lab tools rarely reproduce real tag contention, low-end CPUs, or input delay from long tasks. Track by release and by template, and tie performance marks to business flows such as add-to-cart, search submit, and filter changes. The goal is not a perfect lab score; it is a predictable next paint under real conditions.



