R I S K M O N I T O R

Loading

Intelligent Cybersecurity Check for vulnerabilities now

Making Scrollable Regions Keyboard Accessible

Rule ID: scrollable-region-focusable
Ruleset: axe-core 4.10
User Impact: Serious
Guidelines: WCAG 2.1 (A), WCAG 2.0 (A), WCAG 2.2 (A), Trusted Tester, EN 301 549


How to Fix the Problem

Scrollable regions must be accessible to users navigating with a keyboard. To achieve this, you must ensure that either the scrollable container itself or at least one static (non-interactive) element within it is focusable.

Here are ways to implement that:

✅ Correct Markup Approaches:

Option 1: Make the scrollable container focusable

html
<div style="height: 200px; overflow-y: auto;" tabindex="0">
<div style="height: 2000px;">
<p>Content</p>
</div>
</div>

By adding tabindex="0" to the scrollable container, it becomes part of the tab order, making it accessible to keyboard users.

Option 2: Make an inner static element focusable

html
<div style="height: 20px; overflow: auto;">
<input type="text" tabindex="-1" />
<select tabindex="-1"></select>
<textarea tabindex="-1"></textarea>
<p style="height: 200px;" tabindex="0"></p>
</div>

Even if form controls inside the container are not focusable (tabindex="-1"), a static element like a <p> with tabindex="0" ensures keyboard access to the scrollable region.

⚠️ Conditional Fix (less reliable)

html
<div style="overflow-y: scroll; height: 5px;">
<input type="text" />
</div>

While this may technically allow interaction, browser behavior (e.g., autocomplete interception) can interfere with proper keyboard navigation. It is safer and more robust to directly apply tabindex="0".

❌ Incorrect Markup Examples

html
<div style="height: 5px; overflow: auto;">
<input type="text" tabindex="-1" />
</div>
<div style=“height: 5px; overflow: auto;”>
<input type=“text” tabindex=“-1” />
<select tabindex=“-1”></select>
<textarea tabindex=“-1”></textarea>
</div>

These fail accessibility checks because no element inside the scrollable region is focusable.


Why it Matters

Keyboard users, including individuals with motor impairments or those who use screen readers, rely on keyboard focus to navigate a web page. If a scrollable region cannot be focused via keyboard, these users may be unable to access or explore the content within that region. This creates a serious barrier to accessibility.

Properly marking up scrollable areas ensures that:

  • Users can reach and scroll through overflow content using a keyboard.

  • Focus indicators are visible.

  • Interaction is consistent across browsers and assistive technologies.


Rule Description

Any HTML element containing scrollable content must be accessible using only the keyboard. This ensures that all users, regardless of how they interact with the web, can reach and understand the content.


The Algorithm (in Simple Terms)

  1. Find all elements with scrollable content (overflow: auto or overflow: scroll).

  2. Check if those elements or any static descendant inside them has a tabindex="0" or is otherwise naturally focusable.

  3. Flag the region if no focusable elements are found within it.

Leave A Comment