CriticalWCAG 2.4.3 · Level AOperable
Modal Dialog Focus Trap & Return
Simulates modal dismissal via Escape key and verifies if keyboard focus is properly trapped inside active dialogs and returned to trigger elements upon close.
Rule ID: custom-focus-trap-and-return · reported under Needs review, because a person should confirm it.
Who this affects
Keyboard and screen-reader users get lost when focus jumps to an unexpected place.
WCAG 2.4.3 Focus Order: read the W3C explanation of Focus Order
How to fix it
Problem
<div role="dialog"><button onclick="closeModal()">Close</button></div>Fixed
<div role="dialog" aria-modal="true" aria-labelledby="modal-title"><h2 id="modal-title">Terms</h2><button onclick="closeModal()" ref={closeBtnRef}>Close</button></div>These are short examples. In the extension, A11yEngine points to the element on your own page and can suggest a fix for your code (HTML, React, Vue or Tailwind).
Find this on your own pages
Check any page for this and 100+ other issues in your browser, free.