Scroll
A scroll container for content wider than the screen, such as a data table, so it scrolls on its own instead of widening the page.
Live example
Scroll region
<section data-scroll="inline" aria-labelledby="viewports-caption" tabindex="0">
<table>
<caption id="viewports-caption">Viewports every page is checked at</caption>
<thead>
<tr>
<th scope="col">Width</th>
<th scope="col">Height</th>
<th scope="col">Engines</th>
<th scope="col">Checks</th>
</tr>
</thead>
<tbody>
<tr>
<td>320px</td>
<td>640px</td>
<td>Chromium, Firefox, WebKit</td>
<td>No sideways page scroll, no axe violations</td>
</tr>
<tr>
<td>375px</td>
<td>812px</td>
<td>Chromium, Firefox, WebKit</td>
<td>No sideways page scroll, no axe violations</td>
</tr>
</tbody>
</table>
</section>
API
| Attribute or value | Effect |
|---|---|
data-scroll="inline" | scroll along the inline axis (left/right in English) |
data-scroll="block inline" | also scroll along the block axis, at most --dui-size-pane (the viewport) tall, so a sticky table header stays in view (css/components/organisms/data-table.css) |
- Add
tabindex="0"so keyboard users can scroll it (WCAG 2.1.1, axe rule). - Our choice: a
<section>witharia-labelledby, not<div role="region">, because the native element already has the role. - A table inside keeps
display: table, or it can lose its semantics (Adrian Roselli).
Accessibility
- WCAG 1.4.10 allows two-dimensional scrolling for data tables.
- A named
<section>is a region landmark (HTML-AAM), so the focus stop is announced.
Specifications
- Deque University scrollable region focusable
- W3C el section
- Adrian Roselli tables css display properties and aria
- MDN
scroll - MDN
mask-image - WCAG Reflow
- MDN
overflow-x
See also
- Layouts
- Component API convention
- Accessibility baseline
- Source:
css/layout/scroll.css,examples/base.html
How other systems do it
For comparison only; these are not the standard this system follows.
- Apple Human Interface Guidelines: No equivalent
- Material Design 3: No equivalent
- Vercel Geist: Scroller