| id | 6cfa84 | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | Element with aria-hidden has no content in sequential focus navigation | ||||||||||||||||||||||
| rules_format | 1.1 | ||||||||||||||||||||||
| rule_type | atomic | ||||||||||||||||||||||
| description | This rule checks that elements with an `aria-hidden` attribute do not contain elements that are part of the sequential focus navigation and focusable. | ||||||||||||||||||||||
| accessibility_requirements |
|
||||||||||||||||||||||
| input_aspects |
|
||||||||||||||||||||||
| acknowledgments |
|
This rule applies to any element with an aria-hidden attribute value of true.
None of the target elements has an inclusive descendant in the flat tree that are focusable and part of the sequential focus navigation.
Using aria-hidden="false" on a descendant of an element with aria-hidden="true" does not expose that element. aria-hidden="true" hides itself and all its content from assistive technologies.
By adding aria-hidden="true" to an element, content authors ensure that assistive technologies will ignore the element. This can be used to hide parts of a web page that are pure decoration, such as icon fonts - that are not meant to be read by assistive technologies.
An element with an aria-hidden attribute set to true that is also part of the sequential focus navigation may cause confusion for users of assistive technologies because the element can be reached via sequential focus navigation, but it should be hidden and not included in the accessibility tree.
The 1 second time span introduced in the exception of the definition of focusable is an arbitrary limit which is not included in WCAG. Given that scripts can manage the focus state of elements, testing the focused state of an element consistently would be impractical without a time limit.
Interacting with the page does not result in changing the aria-hidden attribute value of target elements. An example of such a situation would be when closing a modal dialog makes previously hidden elements that were not focusable or part of the sequential focus navigation become focusable and part of the sequential focus navigation.
Some user agents treat the value of aria-hidden attribute as case-sensitive.
- CSS Scoping Module Level 1 (editor's draft)
- Understanding Success Criterion 1.3.1: Info and Relationships
- Understanding Success Criterion 4.1.2: Name, Role, Value
aria-hidden(state)- Fourth rule of ARIA use
- Element with presentational children has no focusable content
This p element is not part of the sequential focus navigation.
<p aria-hidden="true">Some text</p>This a element is not part of the sequential focus navigation because it is hidden through CSS.
<div aria-hidden="true">
<a href="/" style="display:none">Link</a>
</div>This input element is not part of the sequential focus navigation because of the disabled attribute.
<input disabled aria-hidden="true" />This a element is not focusable because it moves focus to the input element whenever it receives focus. These elements
are sometimes referred to as 'focus sentinel' or 'bumper'. They are typically found before and after a modal / dialog in
order to contain focus within the modal. Page authors do not want the sentinel to be visible, nor do they want them to be read by
a screen reader. But, they do want the element to be part of the sequential focus navigation. This allows the page author
to detect that focus has left the dialog in order to wrap it to the top/bottom as appropriate.
<div
id="sampleModal"
role="dialog"
aria-label="Sample Modal"
aria-modal="true"
style="border: solid black 1px; padding: 1rem;"
>
<label>First and last name <input id="dialogFirst"/></label><br />
<button id="closeButton">Close button</button>
</div>
<div aria-hidden="true">
<a href="#" id="sentinelAfter" style="position:absolute; top:-999em"
>Upon receiving focus, this focus sentinel should wrap focus to the top of the modal</a
>
</div>
<script>
document.getElementById('sentinelAfter').addEventListener('focus', () => {
document.getElementById('dialogFirst').focus()
})
document.getElementById('closeButton').addEventListener('click', () => {
document.getElementById('sampleModal').style.display = 'none'
})
</script>This button element is focusable, but not part of the sequential focus navigation because of the tabindex attribute.
<div aria-hidden="true">
<button tabindex="-1">Some button</button>
</div>This svg element with aria-hidden does not have a focusable descendant, focusable ancestors are not a problem for this rule.
<a href="#">
<svg width="16" height="16" aria-hidden="true">
<circle cx="8" cy="11" r="4" stroke="black" stroke-width="2" fill="transparent" />
</svg>
Hello ACT
</a>This a element positioned off screen is part of the sequential focus navigation using the keyboard.
<div aria-hidden="true">
<a href="/" style="position:absolute; top:-999em">Link</a>
</div>This input element is part of the sequential focus navigation because it was incorrectly disabled.
<div aria-hidden="true">
<input aria-disabled="true" />
</div>This button element is part of the sequential focus navigation and a descendant of an element with an aria-hidden attribute value of true because aria-hidden can't be reset once set to true on an ancestor.
<div aria-hidden="true">
<div aria-hidden="false">
<button>Some button</button>
</div>
</div>This p element is part of the sequential focus navigation because of the tabindex attribute.
<p tabindex="0" aria-hidden="true">Some text</p>This summary element is part of the sequential focus navigation.
<details aria-hidden="true">
<summary>Some button</summary>
<p>Some details</p>
</details>This a element is focusable because it fails to move focus when it receives focus. This is in contrast to a focus sentinel that
immediately jumps focus to a valid location. Focus sentinels are typically used before and after a modal dialog in order to contain
and wrap focus. In this case, the focus event was removed, but the sentinel was not.
<div
id="sampleModal"
role="dialog"
aria-label="Sample Modal"
aria-modal="true"
style="border: solid black 1px; padding: 1rem;"
>
<label>First and last name <input id="dialogFirst"/></label><br />
<button id="closeButton">Close button</button>
</div>
<div aria-hidden="true">
<a href="#" id="sentinelAfter" style="position:absolute; top:-999em"
>Upon receiving focus, this focus sentinel should wrap focus to the top of the modal</a
>
</div>
<script>
document.getElementById('closeButton').addEventListener('click', () => {
document.getElementById('sampleModal').style.display = 'none'
})
</script>This aria-hidden attribute is ignored with null value.
<button tabindex="-1" aria-hidden>Some button</button>This aria-hidden attribute is ignored with value false.
<p aria-hidden="false">Some text</p>This aria-hidden attribute has an incorrect value.
<div aria-hidden="yes">
<p>Some text</p>
</div>