Prevent Unexpected Content Movement
Learn how to prevent unexpected content shifts and layout changes that disorient users.
What Is It?
Unexpected content movement includes: ads loading and shifting layout, modal dialogs appearing without warning, images or videos resizing, infinite scroll jumping. Layout shifts frustrate all users.
Affected users: Users with vestibular disorders (BPPV, Meniere's disease), users with ADHD, users with cognitive disabilities, motion-sensitive users, mobile users
Why It Matters
Users with vestibular disorders (affecting balance) suffer vertigo from unexpected movement. Users with ADHD lose focus when content shifts. Poor Core Web Vitals metric (CLS). Mobile users especially affected.
How to Detect This Issue
Load page and watch for layout shifts. Disable ads blockers and watch for ad shifts. Check DevTools Core Web Vitals metrics. Test on slow network (ads load slowly).
Code Examples & Fixes
HTML / CSS
<img src="product.jpg"> <!-- no dimensions, loads and shifts --><img src="product.jpg" width="600" height="400" alt="Product"> <!-- dimensions set, no shift -->Always set width and height on <img> tags. This reserves space before image loads, preventing layout shifts.
React / Next.js
Ads loaded dynamically without space reserved, pushing content down<div style={{minHeight: "250px", backgroundColor: "#eee"}}>
{adLoaded && <Ad />}
</div>Reserve space for dynamic content like ads. Use min-height or aspect-ratio to prevent shifts when content loads.
WordPress
Sidebar ads loaded after page render, pushing contentConfigure WordPress theme to reserve ad space (min-height, flex basis) before ads loadIn WordPress theme, ensure ad spaces have minimum dimensions. Use CSS flexbox or grid to maintain layout while loading.
Shopify Liquid
Product images load without aspect ratio, layouts shift<img src="product.jpg" style={{aspectRatio: "1 / 1"}} alt="Product name">Use CSS aspect-ratio or reserve padding-bottom to maintain space. Shopify product images should have consistent dimensions.
Common Mistakes
Images without width and height attributes (loads slowly, shifts)
Ads or popups appearing suddenly without layout adjustment
Infinite scroll adding content without smooth transitions
Modals appearing with :focus trapped, causing unexpected visual shift
Animations that exceed 3 seconds (too long, distracting)
Frequently Asked Questions
What's Cumulative Layout Shift (CLS)?
How do I reserve space for ads that load late?
Are animations OK if they don't shift layout?
Should I disable ads for accessibility?
Check your website for free
Get your ADA, WCAG, privacy & security score in 90 seconds.