About This Accessibility Rule
When a <frame> or <iframe> has tabindex="-1", the browser removes it from the sequential keyboard navigation order. This means that any focusable elements inside the frame — such as links, buttons, form controls, or other interactive elements — become completely unreachable via the keyboard. If the frame also has scrollable content, keyboard users cannot scroll it either, since focus can never enter the frame to begin with.
This creates a serious barrier for people who rely on keyboards to navigate, including blind users who use screen readers and people with mobility disabilities who cannot use a mouse. Content trapped inside an inaccessible frame is effectively hidden from these users, even though it may be fully visible on screen.
Related WCAG Success Criteria
This rule maps to WCAG 2.1 Success Criterion 2.1.1: Keyboard (Level A), which requires that all functionality be operable through a keyboard interface without requiring specific timings for individual keystrokes. When focusable content is locked inside a frame with tabindex="-1", this criterion is violated because keyboard users cannot access or interact with that content.
This is a Level A requirement — the most fundamental level of accessibility — meaning it must be met for a page to be considered minimally accessible.
How to Fix It
-
Remove
tabindex="-1"from any<frame>or<iframe>that contains focusable content. Without an explicittabindex, the browser will handle focus naturally and allow keyboard users to tab into the frame. -
Use
tabindex="0"if you need to explicitly include the frame in the tab order. -
Only use
tabindex="-1"on frames that genuinely contain no focusable or interactive content. Even then, be cautious — if the frame’s content changes later to include interactive elements, the negative tabindex will silently create an accessibility barrier.
As a general best practice, avoid using tabindex="-1" on frames entirely. It’s easy for frame content to change over time, and a negative tabindex can turn into an accidental accessibility issue after a routine content update.
Examples
Incorrect: Frame with focusable content and tabindex="-1"
The button inside this iframe is unreachable by keyboard because tabindex="-1" prevents focus from entering the frame.
<iframe
srcdoc="<button>Click me</button>"
tabindex="-1"
title="Interactive widget">
</iframe>
Correct: Frame with focusable content and no negative tabindex
Removing tabindex="-1" allows keyboard users to tab into the frame and reach the button.
<iframe
srcdoc="<button>Click me</button>"
title="Interactive widget">
</iframe>
Correct: Frame with focusable content and tabindex="0"
Using tabindex="0" explicitly places the frame in the natural tab order.
<iframe
srcdoc="<button>Click me</button>"
tabindex="0"
title="Interactive widget">
</iframe>
Correct: Frame with no focusable content and tabindex="-1"
When a frame contains only static, non-interactive content (no links, buttons, or form controls), using tabindex="-1" is acceptable because there is nothing inside that requires keyboard access.
<iframe
srcdoc="<p>Hello world</p>"
tabindex="-1"
title="Static content display">
</iframe>
Learn more:
Help us improve our guides
Detect accessibility issues automatically
Rocket Validator scans thousands of pages with Axe Core and the W3C Validator, finding accessibility issues across your entire site.