Skip to content

Commit 19dc17f

Browse files
tombrunetJym77tbostic32WilcoFiers
authored
6cfa84: Change aria-hidden rule to focus on tabbable rather than focusable (#1820)
* Change rule to focus on tabbale vs focusable * Move Fail 5 to Pass 5 * Update _rules/aria-hidden-no-focusable-content-6cfa84.md Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com> * Update expecation / assumptions * Fix description * Reword background statement about item vs tab reading * Fix definition * Adjust sentence regarding tabbable but hidden * Update _rules/aria-hidden-no-focusable-content-6cfa84.md Co-authored-by: Trevor R. Bostic <32486143+tbostic32@users.noreply.github.com> Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com> Co-authored-by: Trevor R. Bostic <32486143+tbostic32@users.noreply.github.com> Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
1 parent a0d0e33 commit 19dc17f

1 file changed

Lines changed: 28 additions & 24 deletions

File tree

_rules/aria-hidden-no-focusable-content-6cfa84.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
id: 6cfa84
3-
name: Element with aria-hidden has no focusable content
3+
name: Element with aria-hidden has no content in sequential focus navigation
44
rule_type: atomic
55
description: |
6-
This rule checks that elements with an `aria-hidden` attribute do not contain focusable elements.
6+
This rule checks that elements with an `aria-hidden` attribute do not contain elements that are part of the sequential focus navigation and focusable.
77
accessibility_requirements:
88
wcag20:4.1.2: # Name, Role, Value (A)
99
forConformance: true
@@ -32,11 +32,11 @@ This rule applies to any element with an `aria-hidden` [attribute value][] of `t
3232

3333
## Expectation
3434

35-
None of the target elements are [focusable][], nor do they have [descendants](https://dom.spec.whatwg.org/#concept-tree-descendant) in the [flat tree](https://drafts.csswg.org/css-scoping/#flat-tree) that are [focusable][].
35+
None of the target elements has an [inclusive descendant][] in the [flat tree][] that are [focusable][] and part of the [sequential focus navigation][].
3636

3737
## Assumptions
3838

39-
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 and not [focusable][] elements become [focusable][].
39+
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][].
4040

4141
## Accessibility Support
4242

@@ -48,7 +48,7 @@ Using `aria-hidden="false"` on a descendant of an element with `aria-hidden="tru
4848

4949
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](https://www.w3.org/TR/WCAG21/#dfn-pure-decoration), such as icon fonts - that are not meant to be read by assistive technologies.
5050

51-
A [focusable][] element with `aria-hidden="true"` is ignored as part of the reading order, but still part of the focus order, making its state of [visible](#visible) or hidden unclear.
51+
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][].
5252

5353
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.
5454

@@ -71,15 +71,15 @@ The 1 second time span introduced in the exception of the definition of [focusab
7171

7272
#### Passed Example 1
7373

74-
This `p` element is not [focusable][].
74+
This `p` element is not part of the [sequential focus navigation][].
7575

7676
```html
7777
<p aria-hidden="true">Some text</p>
7878
```
7979

8080
#### Passed Example 2
8181

82-
This `a` element is not [focusable][] because it is hidden through CSS.
82+
This `a` element is not part of the [sequential focus navigation][] because it is hidden through CSS.
8383

8484
```html
8585
<div aria-hidden="true">
@@ -89,15 +89,15 @@ This `a` element is not [focusable][] because it is hidden through CSS.
8989

9090
#### Passed Example 3
9191

92-
This `input` element is not [focusable][] because of the `disabled` attribute.
92+
This `input` element is not part of the [sequential focus navigation][] because of the `disabled` attribute.
9393

9494
```html
9595
<input disabled aria-hidden="true" />
9696
```
9797

9898
#### Passed Example 4
9999

100-
This `a` element is not [focusable][] because it moves focus to the `input` element whenever it receives focus.
100+
This `a` element is part of the [sequential focus navigation][], but moves focus to the `input` element whenever it receives focus.
101101

102102
```html
103103
<div aria-hidden="true">
@@ -106,11 +106,21 @@ This `a` element is not [focusable][] because it moves focus to the `input` elem
106106
<input />
107107
```
108108

109+
#### Passed Example 5
110+
111+
This `button` element is [focusable][], but not part of the [sequential focus navigation][] because of the `tabindex` attribute.
112+
113+
```html
114+
<div aria-hidden="true">
115+
<button tabindex="-1">Some button</button>
116+
</div>
117+
```
118+
109119
### Failed
110120

111121
#### Failed Example 1
112122

113-
This `a` element positioned off screen is [focusable][] using the keyboard.
123+
This `a` element positioned off screen is part of the [sequential focus navigation][] using the keyboard.
114124

115125
```html
116126
<div aria-hidden="true">
@@ -120,7 +130,7 @@ This `a` element positioned off screen is [focusable][] using the keyboard.
120130

121131
#### Failed Example 2
122132

123-
This `input` element is [focusable][] because it was incorrectly disabled.
133+
This `input` element is part of the [sequential focus navigation][] because it was incorrectly disabled.
124134

125135
```html
126136
<div aria-hidden="true">
@@ -130,7 +140,7 @@ This `input` element is [focusable][] because it was incorrectly disabled.
130140

131141
#### Failed Example 3
132142

133-
This `button` element is [focusable][] 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.
143+
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.
134144

135145
```html
136146
<div aria-hidden="true">
@@ -142,25 +152,15 @@ This `button` element is [focusable][] and a descendant of an element with an `a
142152

143153
#### Failed Example 4
144154

145-
This `p` element is [focusable][] because of the `tabindex` attribute.
155+
This `p` element is part of the [sequential focus navigation][] because of the `tabindex` attribute.
146156

147157
```html
148158
<p tabindex="0" aria-hidden="true">Some text</p>
149159
```
150160

151161
#### Failed Example 5
152162

153-
This `button` element is [focusable][] because of the `tabindex` attribute.
154-
155-
```html
156-
<div aria-hidden="true">
157-
<button tabindex="-1">Some button</button>
158-
</div>
159-
```
160-
161-
#### Failed Example 6
162-
163-
This `summary` element is [focusable][].
163+
This `summary` element is part of the [sequential focus navigation][].
164164

165165
```html
166166
<details aria-hidden="true">
@@ -198,4 +198,8 @@ This `aria-hidden` attribute has an incorrect value.
198198
```
199199

200200
[attribute value]: #attribute-value 'Definition of Attribute Value'
201+
[flat tree]: https://drafts.csswg.org/css-scoping/#flat-tree 'Definition of flat tree'
201202
[focusable]: #focusable 'Definition of focusable'
203+
[inclusive descendant]: https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant 'DOM definition of Inclusive Descendant'
204+
[included in the accessibility tree]: #included-in-the-accessibility-tree 'Definition of Included in the Accessibility Tree'
205+
[sequential focus navigation]: https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation

0 commit comments

Comments
 (0)