Web & Development

How to Fix Poor INP: A Practical Guide to Faster Web Interactions

How to Fix Poor INP: A Practical Guide to Faster Web Interactions

Learn how to diagnose and improve Interaction to Next Paint (INP) with Chrome DevTools, real-user measurements, JavaScript optimization, and practical fixes for slow web interactions.

A website can load quickly and still feel frustratingly slow. A navigation menu takes half a second to open. A search filter freezes while results update. A button appears unresponsive even though its JavaScript handler eventually completes.

These problems are often invisible in traditional page-load measurements.

Interaction to Next Paint (INP) addresses that gap. As one of Google's Core Web Vitals, it measures how responsive a page is to user interactions throughout a visit, rather than focusing only on the initial loading experience.

The good news is that improving INP does not necessarily require a new framework, a faster server, or a complete redesign. Often, the biggest gains come from identifying expensive JavaScript tasks, simplifying rendering work, and allowing the browser to respond sooner.

This guide explains how to measure INP, investigate its causes, and apply practical fixes without relying on misleading performance scores.

What is Interaction to Next Paint?

INP measures the latency of qualifying interactions such as mouse clicks, touchscreen taps, and keyboard input.

For each interaction, the browser measures how long it takes until it can present the next visual frame. INP summarizes responsiveness across the page visit, generally using the slowest qualifying interaction, with an outlier adjustment for pages containing many interactions.

INP replaced First Input Delay (FID) as a Core Web Vital on March 12, 2024. Unlike FID, which focused on the delay before processing the first interaction, INP evaluates responsiveness across the visit and includes processing and presentation time.

Google defines these thresholds:

INP value Assessment
200 ms or less Good
Above 200 ms to 500 ms Needs improvement
Above 500 ms Poor

These thresholds are evaluated using the 75th percentile of real page visits, separately for mobile and desktop.

A page with an INP of 380 milliseconds is not necessarily slow to load. It means its measured interaction responsiveness needs improvement.

Why a fast Lighthouse score does not guarantee good INP

Lighthouse is useful for identifying loading and performance problems, but a conventional page-load audit cannot reproduce every interaction a real visitor might perform.

Consider a product comparison page.

The initial HTML loads quickly, the hero image is optimized, and the JavaScript bundle is relatively small. The page receives a strong Lighthouse performance score.

However, when someone changes a product filter, the application synchronously sorts hundreds of products, rebuilds the results grid, and recalculates layout before showing the updated selection.

The initial page-load score may look excellent while the interaction remains visibly sluggish.

This is why Google recommends starting with real-user data, then reproducing problematic interactions in a controlled development environment.

Understand the three parts of a slow interaction

Every qualifying interaction has three important phases.

Input delay is the time between the user's action and the beginning of event-handler execution. It often increases when the main thread is occupied by other tasks.

Processing duration is the time spent executing the event callbacks associated with the interaction. Expensive filtering, validation, parsing, and synchronous calculations can increase it.

Presentation delay is the time between the completion of event callbacks and the next rendered frame. Complex layouts, large DOM updates, and expensive style calculations can make this phase slow.

These distinctions matter because optimizing the wrong phase may produce little improvement.

Step 1: Find the problematic interactions in real-user data

Start with PageSpeed Insights or Google Search Console's Core Web Vitals report.

PageSpeed Insights can show field data from the Chrome User Experience Report (CrUX), where sufficient data exists. CrUX aggregates eligible real-user experiences, so it provides a more representative view than a single local test.

However, aggregated INP values do not always identify the exact button, menu, or form responsible for poor responsiveness.

For deeper diagnosis, use Real User Monitoring (RUM) to collect interaction attribution data. The official web-vitals library provides a convenient starting point.

Install it:

npm install web-vitals

Then use its attribution build:

import {onINP} from 'web-vitals/attribution';

onINP((metric) => {
    const {value, rating, attribution} = metric;

    console.log('INP:', Math.round(value), 'ms');
    console.log('Rating:', rating);
    console.log('Target:', attribution.interactionTarget);
    console.log('Input delay:', attribution.inputDelay);
    console.log('Processing:', attribution.processingDuration);
    console.log('Presentation:', attribution.presentationDelay);
});

This diagnostic example logs measurements in the browser console. It does not automatically transmit data to a server.

For production monitoring, you can send selected measurements to your own analytics endpoint, ideally using navigator.sendBeacon() when appropriate. Avoid collecting form values, user-entered text, or unnecessary personal information.

Also remember that INP measurements may be updated as a visitor continues interacting with the page. Do not treat the first callback as the final result for the entire visit.

Step 2: Reproduce the problem in Chrome DevTools

Illustration of the article's main concept

Once you know which page or interaction is problematic, open Chrome DevTools and select the Performance panel.

The Live Metrics view can display Core Web Vitals while you interact with the page. You can also record a performance trace and inspect the Interactions track to identify expensive callbacks and rendering work.

Test realistic interactions, including opening navigation menus, submitting forms, changing filters, expanding accordions, and typing into interactive search fields.

Repeat the same action several times and test on a constrained mobile environment when possible. A powerful desktop computer can hide performance problems that are obvious on lower-end phones.

Pay particular attention to long main-thread tasks, expensive event handlers, repeated layout calculations, and large DOM updates.

The goal is not simply to find the longest JavaScript function. It is to understand what prevents the browser from responding promptly to a specific user action.

Step 3: Reduce unnecessary work inside event handlers

A common cause of poor INP is an event handler that performs too many operations synchronously.

Imagine a search interface that filters and renders thousands of products after every keystroke.

searchInput.addEventListener('input', () => {
    const matches = filterProducts(
        allProducts,
        searchInput.value
    );

    sortProducts(matches);
    renderAllProducts(matches);
    updateStatistics(matches);
});

This code may be functionally correct, but it makes every operation part of the same input-processing task.

A better approach is to separate work that must happen immediately from work that can be delayed, reduced, or avoided.

For example, a search interface might debounce expensive filtering while allowing the input field itself to remain responsive.

let searchTimer;

searchInput.addEventListener('input', () => {
    clearTimeout(searchTimer);

    const query = searchInput.value;

    searchTimer = setTimeout(() => {
        const matches = filterProducts(
            allProducts,
            query
        );

        renderVisibleProducts(matches);
    }, 150);
});

This approach can reduce repeated expensive operations during rapid typing.

However, debouncing is not a universal INP fix. The eventual filtering operation may still block the main thread. If it remains expensive, consider smaller workloads, virtualization, indexing, or moving suitable computation to a Web Worker.

Step 4: Break up long JavaScript tasks

JavaScript tasks running on the main thread can prevent the browser from processing input and rendering updates.

For computational work that can be divided into smaller units, yielding between chunks gives the browser opportunities to handle higher-priority tasks.

Modern browsers may support scheduler.yield(), while a timer-based fallback can provide a basic alternative.

async function yieldToBrowser() {
    if ('scheduler' in globalThis &&
        typeof scheduler.yield === 'function') {
        await scheduler.yield();
    } else {
        await new Promise(resolve => {
            setTimeout(resolve, 0);
        });
    }
}

async function processItems(items) {
    const batchSize = 100;

    for (let i = 0; i < items.length; i += batchSize) {
        const batch = items.slice(i, i + batchSize);

        for (const item of batch) {
            processItem(item);
        }

        await yieldToBrowser();
    }
}

This example illustrates cooperative task scheduling. The optimal batch size depends on the cost of each operation and should be established through profiling.

The fallback does not provide the same scheduling guarantees as scheduler.yield(), and yielding alone does not guarantee that a frame will be painted immediately.

For intensive, independent computation, a Web Worker may be a better solution because it moves work away from the main thread.

Step 5: Avoid forced synchronous layouts

Not every slow interaction is caused by computationally expensive JavaScript.

Sometimes the problem is how JavaScript interacts with the browser's layout engine.

Consider this pattern:

element.style.width = '400px';

const width = element.offsetWidth;

After changing an element's width, reading a layout-dependent property such as offsetWidth may force the browser to calculate layout synchronously.

Repeatedly mixing style writes and layout reads can cause layout thrashing.

A better strategy is to group layout reads before writes whenever the logic allows it.

const currentWidth = element.offsetWidth;



Technical workflow illustration
const nextWidth = currentWidth + 40; element.style.width = `${nextWidth}px`;

This does not eliminate all layout work, but it avoids forcing a layout read immediately after the write in this example.

For more complex interfaces, use DevTools to inspect repeated layout calculations and reconsider whether every DOM update is necessary.

Large DOM trees can also increase presentation delay, particularly when an interaction changes styles or structure across many elements.

Step 6: Give users visible feedback before expensive secondary work

Suppose an application lets users add a product to a comparison list.

A poorly structured handler might update recommendations, rebuild a large table, save preferences, and only then update the button label.

From the user's perspective, nothing happens until all the work finishes.

Instead, prioritize the immediate visual response.

compareButton.addEventListener('click', () => {
    compareButton.textContent = 'Added';
    compareButton.disabled = true;

    requestAnimationFrame(() => {
        setTimeout(() => {
            updateRecommendations();
            refreshComparisonSummary();
        }, 0);
    });
});

The intention is to give the browser an opportunity to present the button's new state before performing secondary work.

This pattern follows Google's recommendation to defer non-critical operations beyond the next rendering opportunity. It should still be tested: a very expensive deferred task can hurt later interactions, and the application must preserve correct behavior if the user navigates away or triggers another action.

Step 7: Apply the same principles to WordPress and Joomla

Poor INP is not limited to single-page applications built with React or Vue.

Traditional content management systems can experience the same problems, especially when pages include several interactive extensions.

For WordPress, investigate page builders, filtering plugins, dynamic search interfaces, consent managers, and third-party JavaScript.

For Joomla, examine template scripts, module interactions, frontend extensions, large menus, and scripts loaded globally even when a page does not require them.

The useful distinction is between the CMS generating the HTML and the JavaScript executing in the visitor's browser.

A PHP optimization may improve server response time without addressing an expensive frontend event handler.

Similarly, reducing image sizes may improve Largest Contentful Paint while leaving INP almost unchanged.

Optimization should follow the measured bottleneck rather than assumptions about the platform.

Step 8: Validate the improvement using field data

After implementing a fix, repeat the original interaction in DevTools and compare its timing phases.

If processing duration decreases but presentation delay remains high, investigate DOM size, rendering, and layout work.

If input delay remains high, inspect other tasks competing for main-thread time.

Finally, monitor real-user data after deployment.

CrUX data reflects aggregated user experiences over a rolling period, so improvements may not appear immediately in PageSpeed Insights or Search Console.

Avoid declaring success based on one fast desktop trace. Test realistic devices, different interaction paths, and conditions representative of your visitors.

Does improving INP improve Google rankings?

Core Web Vitals are relevant to page experience, and Google recommends achieving good results.

However, improving INP does not guarantee a ranking increase. Search ranking depends on many factors, including content relevance and usefulness.

Google explicitly cautions that good Core Web Vitals scores do not guarantee good search rankings.

The strongest reason to improve INP is straightforward: visitors should not have to wait unnecessarily for a website to acknowledge their actions.

A responsive interface can improve usability independently of any search ranking benefit.

Final thoughts

INP optimization is not primarily about making every JavaScript function faster. It is about managing the work that stands between a user's action and the browser's next visual response.

Start with real-user measurements. Identify the interaction responsible for poor responsiveness. Separate input delay, processing duration, and presentation delay. Then fix the specific bottleneck.

For many websites, the most effective improvements are surprisingly practical: shorter event handlers, less unnecessary JavaScript, fewer expensive DOM updates, and better prioritization of visible feedback.

The objective is not a perfect laboratory score. It is a website that feels responsive to real people, on real devices, throughout their visit.

Official references