On a content-heavy dashboard, you want offscreen sections to stop costing layout and paint work until the user scrolls to them. How would you reason about using content-visibility, and what are the trade-offs you'd watch for?

technical-conceptual · Senior level · software-engineering

What the interviewer is really asking

Probes whether the candidate understands rendering containment and content-visibility: auto as a tool to skip offscreen rendering work, and can reason about its trade-offs (contain-intrinsic-size, scrollbar jump, find-in-page) rather than treating it as a free win.

What to say

What to avoid

Example answers

Strong: content-visibility: auto tells the browser it can skip rendering work for a subtree while it's offscreen. The big gotcha is layout shift: the browser sizes skipped content as zero, so I always pair it with contain-intrinsic-size set to a realistic estimate so the scrollbar and CLS stay stable. I'd apply it only to the heavy repeated card sections below the fold, measure LCP and CLS before and after, and verify in-page search and tab order still reach the deferred content.

Weak: I'd just add content-visibility: auto to the main container and all the sections. It skips offscreen rendering so the page should get faster everywhere, and the browser handles the sizing automatically.

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.