R040: Document-level horizontal overflow
When one element is wider than the viewport the whole page scrolls sideways, and on a phone that leaves an Arabic reader panning to reach content cut off at the edge.
The check
- Id
- R040
- Category
- Layout
- Default severity
When it fires
At the mobile breakpoint, a 390px viewport, the page's content is more than 4px wider than the viewport, so the whole page scrolls sideways. On a phone that is critical: the reader pans to reach what is cut off at the edge.
Fix: Constrain the offending elements (evidence lists the widest) with max-width: 100% / fluid layouts.
The same at the tablet or desktop breakpoint, 834px or 1440px wide.
Fix: Constrain the offending elements (evidence lists the widest) with max-width: 100% / fluid layouts.
What it leaves alone
Overflow of 4px or less, which is rounding and scrollbar noise, and sideways scrolling inside an element, like a wide table in its own scroll container, which does not widen the page. It is not limited to Arabic pages: an overflowing page is broken in any language.
Broken, then fixed
.hero-banner {
width: 600px;
}.hero-banner {
width: 600px;
max-width: 100%;
}Check it by hand
With the viewport at phone width, run [document.documentElement.scrollWidth, document.documentElement.clientWidth, [...document.querySelectorAll('body *')].filter((e) => { const r = e.getBoundingClientRect(); return r.right > innerWidth || r.left < 0; }).slice(0, 5)] in the DevTools console. A first number larger than the second is the finding, and the list shows elements sticking out on either side; on a right-to-left page overflow often runs off the left.
What the report shows you
Each R040 finding carries the fields below that apply to it, so you can see why it fired without rerunning the scan.
- scrollWidth
- How wide the page's content is, in pixels.
- clientWidth
- How wide the viewport is, in pixels.
- breakpoint
mobile,tabletordesktop.- widestElements
- The elements that reach furthest past the viewport, with their size: the place to start.
Does your page trip R040?
Paste a URL. Ritla renders the page on desktop, tablet and mobile, runs every check, and shows the top issues with screenshot evidence.
Scan a page freeBrowse the checks