-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Consider the following situation:
A modal dialog is displayed and is wrapped in a keyboard trap. All content behind the modal has aria-hidden="true"
applied to it, but interactive elements are left in the tab order. Additionally, the modal dialog has aria-modal="true"
set. However,
- Because of
aria-hidden="true"
, it is not possible to navigate to the parent content in reading mode. - Because of the keyboard trap that limits tab and shift+tab to modal content, it is not possible to navigate to interactive content outside of the modal.
aria-modal="true"
limits navigation to the modal content in most screen readers- Only content in the modal appears in the screen reader's element list when the modal is open
I can't share an actual example of this (firewalls and whatnot), so here is some pseudo code:
<!-- parent content -->
<div aria-hidden="true">
<p>we have the best stuff</p>
<button>apply now</button>
</div>
<!-- open modal wrapped in a keyboard trap -->
<div class="keyboard-trap" tabindex="0"></div>
<div role="dialog" aria-hidden="true" aria-labelledby="dialog-title">
<h2 id="dialog-title">Are you sure?</h2>
<p>Please make sure that you are sure!</p>
<button>Close</button>
</div>
<div class="keyboard-trap" tabindex="0"></div>
In this example, the "Apply now" button is in the tab order and would fail this rule as currently written, however, to my knowledge, it is impossible to actually navigate to it.
Should this rule still fail?
Referenced rule: https://act-rules.github.io/rules/6cfa84
Update: I found a pattern that is implemented like this in the wild, https://material.angular.io/components/dialog/examples
I tested with I tested with VO/iOS, VO/MacOS, Jaws, and NVDA, and none were able to access content outside of the modal (readig mode, tab or shift+tab, or via the elements list).