Performance

Improving CLS: preventing unexpected page movement

Pingsivo · 1533 words · Updated 7 October 2026

English editorial adaptation prepared with AI assistance. Hypothetical examples are labelled. Technical sources accompany the relevant explanations.

Investigate unexpected layout shifts by watching the loading and interaction sequence, not only the final screenshot. Reserve appropriate space for media and dynamic content, examine fonts and translations, and repeat relevant page states. A stable layout should remain flexible and accessible; fixing movement does not mean assigning arbitrary fixed heights to every component.

Start with the visitor's problem

Describe the movement that matters: a button moves before a click, text jumps during reading, or a banner pushes a form away. Record the page state and action surrounding the event.

A final screenshot can look perfect after the disruption has already happened. Observe the sequence on representative screens and network conditions, including slower arrival of optional resources.

The web.dev CLS optimisation guide explains common sources and investigation methods. Apply it to a reproducible event rather than treating every visible animation as the same kind of shift.

Check image and media space

Images and embedded media need appropriate dimensions or aspect-ratio information so the layout can reserve space before the resource arrives. Inspect responsive variants as well as desktop defaults.

Avoid replacing unknown dimensions with an arbitrary height that clips content or creates large gaps. The reserved geometry should match the component's intended behaviour across screen sizes.

Verify the final visual result and the loading sequence after a change. The LCP guide explains why media changes can affect loading performance as well as stability.

Inspect content inserted after rendering

Banners, recommendations, advertisements, consent controls and remote widgets can alter available space. Identify which insertion coincides with the movement and whether the page anticipated it.

Preserve essential notices and controls. Hiding required content merely to avoid movement is not an acceptable design fix. Instead, choose an appropriate placement and predictable layout behaviour.

Test successful, empty and error states. A component may reserve space for its normal content but collapse or expand unexpectedly when a request fails or returns a different amount of information.

Check text, fonts and translations

Font changes can alter line breaks and block dimensions. Observe readable fallback behaviour and how the layout responds when the preferred font becomes available.

Translations can be longer than the original language. A layout that appears stable in French may wrap differently in English or at a larger text size. Test real strings rather than only short placeholder text.

Do not restrict text solely to preserve a screenshot. Readability, zoom and accessibility remain requirements. A successful correction accommodates content rather than forcing visitors into one fixed presentation.

Observe interactions and scrolling

Loading is only one part of the page's lifetime. Menus, validation messages, expanding sections and dynamically loaded content can also change layout. Reproduce common actions and meaningful error paths.

Distinguish expected interface changes from unexpected movement using the metric's actual rules and the visitor's experience. Do not assume that every expanding component is automatically defective.

Check keyboard focus and the position of the active control. A visually tidy change can still disrupt navigation if focus is lost or the relevant element becomes difficult to find.

Prioritise disruptive movement

Fix shifts that interfere with reading, clicking or completing a task. A reproducible movement affecting a primary control may deserve attention before a minor change in an irrelevant region.

Make one targeted correction and repeat the same scenario. Retain the original observation, device profile and content state so that the comparison remains meaningful.

Check other performance dimensions afterwards. Extra scripts, oversized placeholders or delayed content can introduce new problems while improving one number. The INP guide addresses interaction responsiveness.

Connect local investigation with field evidence

A local test helps reproduce causes under selected conditions. Field data can describe broader visitor experiences where enough eligible observations exist. Neither substitutes perfectly for the other.

The CrUX and laboratory guide explains scope and collection windows. Missing field data is not proof of a flawless layout, and origin-level data does not certify every page.

Record the deployment date and affected components. A performance budget can include responsibilities and checks so that later content or widget changes do not silently reintroduce the problem.

Reproduce a shift before choosing a layout fix

Start with a short description of the disrupted task. A reader losing their place, a button moving before activation and a form jumping after validation are different scenarios. Record the viewport, language, text size and page state. These details matter because the same component can wrap or expand differently under other conditions. A final screenshot cannot show the sequence, so preserve an observation of the movement or a reproducible set of steps. The goal is to identify when the shift occurs and what changed immediately around it.

In a hypothetical article page, a media block initially occupies little space and then expands when its contents arrive. Reserving an appropriate aspect ratio may be a candidate correction, but the exact implementation should reflect the component's actual design. An arbitrary fixed height can create a different problem when the viewport narrows or the content changes. Test the intended geometry across relevant layouts and keep the text or controls readable. Stability should come from predictable structure, not from clipping content until a chosen screenshot looks tidy.

Dynamic notices need similar care. A banner may be required and useful, yet its insertion can displace content unexpectedly. Consider placement and reserved space without removing necessary information. Check the state in which the notice is absent, present, dismissed or replaced by an error. A component that behaves well only in its default success state is not fully validated. If the content comes from another system, document the range of expected content and what should happen when it is delayed or unavailable.

Language and accessibility checks should be part of the experiment. English and French phrases can have different lengths, and users may enlarge text or use a narrower viewport. A correction that depends on a short label fitting exactly on one line can fail under those ordinary conditions. Test actual translated strings and meaningful error messages. Preserve keyboard focus and access to controls when content expands. The question is not merely whether a numeric shift indicator falls, but whether the interface remains predictable for people completing the task.

Font behaviour deserves observation rather than automatic blame. If line breaks change as a font becomes available, investigate the specific relationship and the chosen fallback. Do not assume that every movement is caused by typography simply because a custom font exists. Keep the resource timing and layout event connected through evidence. Where a change is made, verify readability, wrapping and the final design. A performance correction that makes text difficult to read or changes the intended hierarchy needs further work even if one measurement improves.

After selecting a targeted correction, repeat the original scenario and a small set of relevant alternatives. Include at least the device and language where the issue was observed. Check a loading sequence, an interaction path and a failure or empty state if the component supports them. These are meaningful checks because they exercise the conditions that can change layout. They are more useful than a large number of screenshots taken only after every resource has finished and the opportunity to observe movement has passed.

Keep other performance dimensions visible. Reserving excessive space, adding scripts or delaying content can trade one problem for another. Compare main-content loading, interaction response and task completion alongside the stability observation. The report should state which behaviour improved and whether the correction introduced new constraints. If the change cannot yet be tested in a particular context, record that limitation rather than claiming universal stability across all devices and content combinations.

For long-term maintenance, document the component's space requirements and the content assumptions behind the fix. Future editors should know, for example, why media dimensions or predictable notice placement matter. Connect the note to a practical review step when templates, fonts or translations change. This keeps the original reasoning available and makes a later regression easier to recognise. A stable interface is an ongoing property of content and component behaviour, not a permanent achievement conferred by one successful audit run.

Retain the content used to reproduce the issue where practical. A different heading, image ratio or validation message can change wrapping and layout behaviour. The comparison should make those differences visible rather than silently attributing every improved screenshot to the code change.

FAQ: stabilising flexible layouts

Is the final screenshot enough to assess CLS?

No. It may hide movement that occurred earlier. Observe the loading and interaction sequence, including slow resources and alternate states.

Should every block have a fixed height?

No. Arbitrary fixed heights can clip translations, enlarged text or dynamic content. Reserve appropriate space using the component's actual responsive behaviour.

Why does the problem not appear in every run?

Resource timing, cached state, content and device conditions can differ. Reproduce the relevant scenario and record those conditions instead of assuming the issue is imaginary.

Are third-party components always responsible?

No. First-party media, fonts and dynamic interface code can also contribute. Identify the actual event before assigning responsibility.

Can fixing CLS worsen another metric?

Yes, a poorly chosen intervention can add work or delay useful content. Check loading, interaction and functionality alongside stability after each correction.

Related guides and next steps