Skip to content

aria-hidden-focus (6cfa84): as it applied to modal content (keyboard trap and aria-modal) #643

@mfairchild365

Description

@mfairchild365

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).

Metadata

Metadata

Labels

RuleUse this label for a new rule that does not exist alreadyRule UpdateUse this label for an existing rule that is being updated

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions