Accessibility

a11y/scrollable-region-focusable

A scrolling region with no focusable content inside can itself take focus (tabindex="0") and has a name.

seriousbrowserWCAG 2.1.1 · Afe-a11y-keyboard

Why

A code block, a wide table or a chat log with overflow: auto scrolls only with a mouse or touch when nothing inside it can take focus. Keyboard users cannot read the hidden part.

Fix

Give the scroll container tabindex="0", a role that fits (region), and a name (aria-label or aria-labelledby), so it is announced when it takes focus.

Examples

<!-- bad -->
<div class="table-scroll"><table>…</table></div>
<!-- good -->
<div class="table-scroll" tabindex="0" role="region" aria-labelledby="sales-caption">
  <table><caption id="sales-caption">Sales by month</caption>…</table>
</div>

Sources

Facts

Id
a11y/scrollable-region-focusable
Severity
serious
Check
browser needs a rendered page: audit --url
Applies to
page
WCAG 2.2
2.1.1, level A
Same problem in
axe-core scrollable-region-focusable
Taught by the skill
fe-a11y-keyboard Keyboard access and focus
Since version
0.1.0

Rule file on GitHub

Read it in the terminal

npx github:dawidolko/frontend-skills explain a11y/scrollable-region-focusable