- Success Criterion 2.1.2
- Conformance level A
- W3C reference F10
Keyboard Focus Stuck Inside an Embedded Plugin or Widget
2.1.2 — No Keyboard Trap
Scenario
Setting
An email client's compose window
What’s wrong
Keyboard focus can get stuck inside an embedded plugin/format (video player, widget) and the user cannot Tab back out to the rest of the page.
Example
<div class="compose-window">
<textarea>...</textarea>
<iframe src="video-preview.html" class="attachment-preview"></iframe>
</div>
<!-- the iframe's internal player captures all Tab presses and never returns focus to the textarea --> Why it matters
A user composing an email tabs into an attached video preview and can never tab back out to finish writing or send the message.
How to test
Tab into any embedded plugin/format (PDF viewer, old Flash-style widget): confirm Tab or Shift+Tab can move focus back out to the surrounding page.
How to fix
An embedded widget must let Tab and Shift+Tab move focus back out to the surrounding page once its own controls are exhausted.
videoPreview.addEventListener('keydown', (e) => {
if (e.key === 'Tab' && isLastControl(document.activeElement)) {
e.preventDefault();
document.querySelector('.send-btn').focus();
}
}); Outcome
A user tabs through the video preview and continues straight on to the Send button.
Who is affected
Keyboard-only users get permanently stuck inside the embedded player, unable to reach the rest of the compose window.
Learn more
- Understanding Understanding document (opens in a new tab)
- Technique Related technique (opens in a new tab)
Related scenarios
- Modal Focus Trap With No Escape Key or Close Button
- Widget Where Tab Cycles Internally With No Way Out
- Third-Party Embed That Captures and Never Releases Tab Focus
- Script That Yanks Focus Back Every Time the User Tabs Away
- Rich Text Editor That Captures Tab With No Documented Escape
- Autocomplete List That Keeps Recapturing Focus on Every Blur