• Success Criterion 2.1.2
  • Conformance level A

Third-Party Embed That Captures and Never Releases Tab Focus

2.1.2 — No Keyboard Trap

Scenario

Setting

A hospital's patient portal appointment scheduler

What’s wrong

Third-party chat/ad/survey iframes that capture Tab and never release.

Example

<iframe src="https://survey-vendor.example.com/embed/123" class="satisfaction-survey"></iframe>
<!-- the vendor's script inside the iframe listens for Tab and loops focus back to its own first field -->

Why it matters

A patient who tabs into the satisfaction survey after booking can never tab back out to confirm their appointment details or navigate away.

How to test

Tab into a third-party chat/ad/survey iframe: confirm Tab eventually releases focus back to the host page — if it captures Tab indefinitely, it fails.

How to fix

Third-party embeds still count against this success criterion; test every embed's Tab behavior and add an escape hatch if the vendor can't fix it.

// coordinate with the vendor to remove the internal Tab trap, or wrap the iframe:
iframeWrapper.addEventListener('keydown', (e) => {
  if (e.key === 'Escape') document.querySelector('.confirm-btn').focus();
});

Outcome

A patient tabs past the survey and back to the appointment confirmation without getting stuck.

Who is affected

Keyboard-only users lose access to the rest of the portal once focus enters a third-party embed that swallows every Tab press.

Learn more