All jobs / Frontend / web developer / Performance
Frontend / web developer interview question · 1–3 years
A late-loading banner pushes content down (CLS). How do you prevent it?
The strongest answer
Reserve space with min-height, aspect-ratio, or a skeleton — or overlay the banner; don't inject unsized blocks above content
Why it works
CLS cares about unexpected movement. Reserved space is the fix; a pretty animation is still a shift.
What a good answer covers
- Don't move painted content.
- Reserve the banner's box.
- Or overlay without pushing.
- Never silence the metric instead of fixing the shift.
Answers that fall short
- Close, but not the strongest: Animate the shift so it feels smoother
Animation does not remove the layout jump. - Weak: Measure after paint and jump to the new position
Post-paint jumps are the metric. - Red flag: Drop the CLS metric in RUM so the score looks fine
Hiding a metric is not a performance win.
Who gets asked this
More Performance questions
- LCP is a hero image. What do you change first?
- Clicking Filter freezes the tab for about 400ms. How do you investigate?
- Product asks if the new home is faster. What do you report?
- How do you ingest Web Vitals without drowning the backend or leaking PII?
- How do you keep marketing JS from growing without anyone noticing?
- Ten thousand rows in a div and the tab dies. What do you do?
- A feature flag flips the hero after hydrate (flicker). How do you prevent it?
- An SSR page waits for user, then cart, then recommendations, sequentially. What's the issue and the fix?