DEV Community

Cover image for INP Subparts and Long Animation Frames: Diagnose Slow Interactions With LoAF Data
Apogee Watcher
Apogee Watcher

Posted on Originally published at apogeewatcher.com

INP Subparts and Long Animation Frames: Diagnose Slow Interactions With LoAF Data

Interaction to Next Paint looks like a single score on PageSpeed Insights and in CrUX. Under that score sit three clocks: how long the browser waited before your handlers ran, how long those handlers took, and how long it took to paint the next frame. Teams that treat INP as “JavaScript is slow” often ship a blanket defer pass, watch Total Blocking Time move, and leave the real click still lagging.

What follows names those INP subparts, shows how Long Animation Frames (LoAF) expose the scripts and style/layout work behind them, and maps fixes to the phase that is actually expensive. For metric thresholds and the wider Core Web Vitals set, start with how to improve INP alongside LCP and CLS. Script loading attributes live in the field guide to defer vs async scripts. The job here is diagnosis: see the phase, then choose the change.

What INP subparts are

Google’s optimize INP guidance breaks each interaction into three parts whose sum is the interaction latency that can become the page’s INP (typically the longest interaction, with some outlier handling):

Subpart Starts Ends What usually inflates it
Input delay User click, tap, or key First event callback for that interaction begins Long tasks already on the main thread; script parse/compile; overlapping earlier interactions
Processing duration Event callbacks start All callbacks for that interaction finish Heavy handlers; too much work before yield; forced style/layout
Presentation delay Callbacks finished Next frame painted with the visual result Large DOM; expensive style/layout; slow requestAnimationFrame work; client-rendered HTML

A good INP target remains 200 ms or less at the 75th percentile (mobile and desktop separately), as on web.dev. The useful move for ticket work is not memorising that number again; it is asking which of the three columns ate the budget. That question turns a vague “INP is red” ticket into a phase-specific fix.

Chrome’s Event Timing API and the attribution build of the web-vitals library expose inputDelay, processingDuration, and presentationDelay for the INP candidate. When LoAF is available, attribution can also attach overlapping long-animation-frame entries and the longest intersecting script. That is how you move from “INP is 480 ms” to “processing duration is 320 ms and this sourceURL owned most of it.”

How to diagnose which INP subpart is slow

Start with field evidence when you have it. CrUX and the field section of PageSpeed Insights tell you whether INP is poor; they rarely name the interaction or the phase. A RUM product that records Event Timing attribution, or a small web-vitals snippet with attribution, is how agencies and product teams usually learn which click failed. Without that, reproduce common flows in the lab: open the page, interact during load (when the main thread is busiest), and again after idle.

In Chrome DevTools, record a Performance profile, click the control that feels late, and inspect the interaction’s timing track. Look for a long gap before handlers (input delay), a tall stack of event listeners (processing duration), or style, layout, and paint after handlers return (presentation delay). Chrome’s identify INP causes guidance recommends reading subparts first, then using LoAF to separate script cost from style and layout cost.

Lab INP is not CrUX INP. A single throttled click proves a mechanism; scheduled lab tests prove you did not regress after the fix; field data proves users still feel the change weeks later. Treat those as three clocks, not one truth, or you will argue about green screenshots while CrUX stays amber.

What Long Animation Frames (LoAF) measure

The Long Animation Frames API reports frames where rendering was delayed beyond 50 ms. Unlike the Long Tasks API, which surfaces individual tasks over 50 ms inside a browsing context, LoAF looks at the whole frame: tasks plus the rendering update that follows. Several short tasks can sum to a long frame that Long Tasks never flags. That pattern is common on tag-heavy agency sites, so LoAF is the better companion when you need to diagnose INP without a single obvious long task.

Observe entries with a PerformanceObserver on type long-animation-frame (prefer the observer over getEntriesByType so you do not lose entries when the buffer fills), and start with these fields:

Field Use when diagnosing
duration Overall length of the long animation frame (presentation time nuances vary by Chrome version)
blockingDuration How much of the frame blocked high-priority work such as input
startTime / renderStart When the frame’s work began vs when rendering work began
styleAndLayoutStart When style and layout calculations started in the frame
firstUIEventTimestamp When the first UI event in the frame was queued (0 if none)
scripts[] Scripts over ~5 ms: sourceURL, sourceFunctionName, invoker / invokerType, durations, forced style/layout

invokerType values such as event-listener, user-callback, classic-script, and module-script tell you whether the cost sat in a click handler, a requestAnimationFrame callback, or script evaluation. That distinction stops the habit of blaming the theme library when the expensive line is a tag manager callback or a vendor module. Write the invoker type into the ticket and spare the next engineer the same guess.

LoAF is available in Chromium-based browsers from Chrome 123 onward, but it is not a Core Web Vital itself. Treat it as diagnostic data for people who already own an INP budget and need script-level proof. It is not another generic “optimise JavaScript” note.

Map LoAF data to INP subparts

Think of LoAF as a magnifying glass on the same timeline Event Timing already split into three. Each long frame carries scripts and style/layout timestamps you can place on input delay, processing duration, or presentation delay. Once the phase is named, the fix list shrinks to that column alone.

Input delay often shows as main-thread work that began before your interaction’s handlers. LoAF scripts with classic-script or module-script invokers during load, or long tasks that push firstUIEventTimestamp far ahead of handler start, point here. Field attribution that places longestScript.subpart on input-delay is the same story with less guesswork.

Processing duration is where event-listener invokers usually live. If LoAF scripts stack on the click handlers and forcedStyleAndLayoutDuration climbs, you are reading layout thrashing inside the interaction, not a mysterious paint problem. Fix the read/write order in that handler before you chase CSS animations that never appeared in the profile.

Presentation delay shows after handlers finish: user-callback from requestAnimationFrame, ResizeObserver or IntersectionObserver work, and high frame-level style/layout duration. Chrome’s guidance separates script-forced style/layout (forcedStyleDuration / forcedLayoutDuration where available) from frame-level styleDuration / layoutDuration. High style cost suggests expensive selectors or broad invalidation; high layout cost suggests geometry thrashing or a heavy DOM. Those two remediations are different tickets, so keep the numbers separate in the write-up.

Google’s find slow interactions in the field article documents how web-vitals attribution attaches overlapping LoAF entries to the INP candidate. Use that path when you can instrument production. Reach for DevTools when you need a reproducible lab case for a pull request, and keep both artefacts on the ticket so the fix and the proof travel together.

How to fix INP input delay

Fixing input delay starts by asking what already owned the main thread when the user clicked. Common causes during load include large scripts still parsing and compiling, third-party tags evaluating, timers and fetch handlers, and earlier interactions still draining the queue. Until you name that competing work, every defer change is a coin toss.

Reduce competing main-thread work before the interaction window. Prefer defer or type="module" for non-critical scripts so HTML parsing is not blocked by synchronous evaluation; the decision tree for attributes is in defer versus async scripts. Break large bundles so evaluation does not create multi-hundred-millisecond tasks at startup. For tags you do not control, triage with the same honesty you use for LCP third parties: identify the worst offenders, delay what marketing can accept, and remove what nobody can defend. That workflow is covered in our guide to third-party scripts that hurt performance.

Input delay after load often means overlapping interactions or background work (analytics beacons, idle hydration, service worker message storms), so profile the idle main thread, not only the click. If LoAF shows no script of yours during the delay, look for work in iframes. Each frame has its own main thread, and INP can include slow interactions inside embedded content.

How to shorten INP processing duration

When processing duration dominates, the handlers themselves are the product. Do the minimum required to update the UI for the next frame; defer the rest. web.dev’s pattern of updating the visible state first, then scheduling non-critical work with requestAnimationFrame plus setTimeout(0) (or another yield) keeps the next paint from waiting on word-count side effects, spell-check, or remote saves. That split is usually enough to turn a 300 ms handler into a short visual update plus background work the user never waits on.

Yield often enough that other interactions are not queued behind one long task. Prefer structured yields after the visual update rather than random setTimeout sprinkled through a handler, and avoid layout thrashing: do not write to the DOM and immediately read geometry properties in the same turn. Batch reads, then writes; if LoAF reports forced style and layout inside an event-listener script, treat that measurement as the defect to fix in the pull request, not as a soft suggestion.

Third-party listeners on the same click can inflate processing duration even when your code is slim. Attribution that names a sourceURL on a vendor domain is enough evidence to open a ticket with marketing instead of rewriting the theme again. Keep a short list of which vendors sit on click and submit handlers so the next INP spike is not a mystery.

How to cut INP presentation delay

Presentation delay is the gap from “handlers finished” to “pixels updated.” Large DOMs make style and layout scale poorly. Where you can flatten structure or defer off-screen regions with content-visibility, rendering work after interactions shrinks. Be careful with client-rendered HTML: building large trees in JavaScript after a click pays parse and render costs that streamed HTML would have spread out. If LoAF shows long style and layout after a clean handler, the DOM cost is the ticket, not another micro-optimisation inside the listener.

Watch requestAnimationFrame callbacks: they run before the frame paints, so a heavy rAF callback attached to the interaction lengthens presentation delay even when event listeners looked healthy. LoAF user-callback entries are the usual fingerprint. ResizeObserver or IntersectionObserver callbacks in the same rendering cycle can pile on more main-thread work after your click handler returns.

Layout shifts that appear after a click are a related UX story, not a separate mystery. If the interaction “works” but content jumps, pair this diagnosis with late CLS after load. Late-injected UI can hurt both INP and CLS without sharing a single metric.

Verify INP fixes with lab schedules and field follow-up

Phase-level fixes fail quietly when nobody retests the same URL. After you change handlers, script order, or DOM cost, reproduce the interaction in DevTools once for the pull request. Then put the URL on a scheduled lab cadence with budgets so a regressing deploy is visible before the retainer review. Watcher’s role here is the boring part of the story: multi-site lab history and alerts so INP work is not a one-off Performance panel session.

Field LoAF and CrUX INP lag behind deploys, so tell the client which clock you are reading. Lab green after a processing-duration fix is necessary, but not enough on its own until the 28-day field window moves. Agencies that report only the lab screenshot set themselves up for a confused QBR when CrUX is still amber.

Layer monitoring onto whatever RUM or analytics stack you already use. You do not need to rip out product analytics to schedule PageSpeed checks across a portfolio. Scheduled lab runs catch the deploy that reintroduces a heavy handler; field LoAF and CrUX confirm whether users felt the improvement.

FAQ

What are the three INP subparts?

Input delay (wait before handlers), processing duration (handlers run), and presentation delay (time until the next frame with the visual result); their sum is the interaction latency that can become INP.

How do Long Animation Frames help diagnose INP?

LoAF reports frames over 50 ms with script attribution and render timing, and overlapping LoAF entries explain which scripts and style/layout work sat inside the INP candidate’s subparts, including cases Long Tasks miss.

Is LoAF the same as the Long Tasks API?

No: Long Tasks flag individual tasks over 50 ms, while Long Animation Frames cover the whole frame, including several shorter tasks plus rendering, so prefer LoAF when the goal is INP diagnosis.

Can I fix INP with only defer and async?

Sometimes, when input delay is dominated by parse and evaluate during load. When processing or presentation delay dominates, defer alone will not repair the handlers or the paint path. Measure the subpart first.

Does lab INP match CrUX INP?

Not reliably. Lab proves a mechanism under controlled conditions; CrUX reflects real devices, networks, and interaction mix. Use both: diagnose in the lab, confirm in the field.

Where do third-party scripts show up?

They show up in input delay (evaluation and long tasks) and in processing duration (vendor listeners on the same event). LoAF sourceURL and invokerType usually name them, so triage with a clear owner rather than a blanket blocklist.

Put the slow phase on a schedule

If you own INP tickets this week, pick one failing interaction, read its subparts, and collect LoAF (or attribution) for that click before you rewrite the theme. Fix the phase the data names. Then schedule lab checks on that URL so the next deploy cannot quietly undo the work while field INP is still catching up.

Run a free multi-page check at apogeewatcher.com/check, or sign up to keep budgets and alerts on the sites you already diagnose by hand.

References

Top comments (0)