A page scores poorly on Cumulative Layout Shift. How would you go about diagnosing and fixing it?

technical-conceptual · Junior level · software-engineering

What the interviewer is really asking

Assesses whether the candidate can connect the CLS metric to its concrete causes (unsized media, injected content, late fonts) and propose targeted, current fixes.

What to say

What to avoid

Example answers

Strong: First I'd open DevTools and use the layout-shift tooling to see exactly which elements jump and when. Usually it's images without explicit width and height, so the browser can't reserve space until they load, or it's a banner or ad injected at the top that shoves content down. I'd set width and height attributes or an aspect-ratio on the media, give dynamic elements a reserved slot, and use font-display so swapping fonts doesn't reflow the text.

Weak: I'd try to make the page load faster overall, maybe compress the images and add a loading spinner. If the score is still bad I'd just remove whatever is causing it from the page.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.