You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the aria-required-owned rule [bc4a75] to include the elements with implicit roles (#2318)
* update the examples for aria-required-owned rule
* update the test cases
* fix syntax errors
* remove implicit/explicit from the description
Co-authored-by: Wilco Fiers <[email protected]>
* add more Pass and Fail test cases
* fix formatting issue
* add more test cases
* update the test cases
* remove unused explcit_semantic_role
* Add one more Failed example
---------
Co-authored-by: Wilco Fiers <[email protected]>
Copy file name to clipboardExpand all lines: _rules/aria-required-owned-element-bc4a75.md
+97-11Lines changed: 97 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ name: ARIA required owned elements
4
4
rules_format: 1.1
5
5
rule_type: atomic
6
6
description: |
7
-
This rule checks that an element with an explicit role that restricts which elements it can own only owns such elements.
7
+
This rule checks that an element with a semantic role that restricts which elements it can own only owns such elements.
8
8
accessibility_requirements:
9
9
wcag20:1.3.1: # Info and Relationships (A)
10
10
forConformance: true
@@ -27,7 +27,7 @@ acknowledgments:
27
27
28
28
## Applicability
29
29
30
-
This rule applies to any [HTML or SVG element][] that is [included in the accessibility tree][] and has a [WAI-ARIA 1.2][][explicit semantic role][] with [required owned elements][], except if the element has an [inclusive ancestor][] in the accessibility tree with an `aria-busy`[attribute value][] of `true`.
30
+
This rule applies to any [HTML or SVG element][] that is [included in the accessibility tree][] and has a [WAI-ARIA 1.2][][semantic role][] with [required owned elements][], except if the element has an [inclusive ancestor][] in the accessibility tree with an `aria-busy`[attribute value][] of `true`.
31
31
32
32
## Expectation
33
33
@@ -45,7 +45,7 @@ The applicability of this rule is limited to the [WAI-ARIA 1.2 Recommendation][w
45
45
46
46
### Assumptions
47
47
48
-
If the [explicit semantic role][] on the target element is incorrectly used, and any relationships between elements are already programmatically determinable, failing this rule may not result in accessibility issues for users of assistive technologies, and it should then not be considered a failure under [WCAG success criterion 1.3.1 Info and Relationships](https://www.w3.org/TR/WCAG22/#info-and-relationships).
48
+
If the [semantic role][] on the target element is incorrectly used, and any relationships between elements are already programmatically determinable, failing this rule may not result in accessibility issues for users of assistive technologies, and it should then not be considered a failure under [WCAG success criterion 1.3.1 Info and Relationships](https://www.w3.org/TR/WCAG22/#info-and-relationships).
49
49
50
50
### Accessibility Support
51
51
@@ -93,16 +93,16 @@ This element with the `menu` role only owns elements with the `menuitem`, `menui
This element with the `tablist` role only owns elements with the `tab` role. The `tab` role is one of the [required owned elements][] for `tablist`. The `li` element is ignored because it has an [explicit semantic role][] of `none`.
105
+
This element with the `tablist` role only owns elements with the `tab` role. The `tab` role is one of the [required owned elements][] for `tablist`. The `li` element is ignored because it has an [semantic role][] of `none`.
106
106
107
107
```html
108
108
<ulrole="tablist">
@@ -139,6 +139,56 @@ This element with the `menu` role only owns an element with a `group` role. The
139
139
</div>
140
140
```
141
141
142
+
#### Passed Example 7
143
+
144
+
The element `ul` with an implicit `list` role owns an element `li` with an implicit `listitem` role.
145
+
146
+
```html
147
+
<ul>
148
+
<li>Item 1</li>
149
+
</ul>
150
+
```
151
+
152
+
#### Passed Example 8
153
+
154
+
The element `select` with an implicit `listbox` role owns elements `option` with implicit `option` roles.
155
+
156
+
```html
157
+
<selectmultiple>
158
+
<option>Item 1</option>
159
+
<option>Item 2</option>
160
+
<option>Item 3</option>
161
+
</select>
162
+
```
163
+
164
+
#### Passed Example 9
165
+
166
+
The element `table` with an implicit `table` role owns an element `tr` with implicit `row` role that in turn owns elements `td` with implicit `cell` roles.
167
+
168
+
```html
169
+
<table>
170
+
<tr>
171
+
<td>Item 1</td>
172
+
<td>Item 2</td>
173
+
<td>Item 3</td>
174
+
</tr>
175
+
</table>
176
+
```
177
+
178
+
#### Passed Example 10
179
+
180
+
The element `table` with an explicit `treegrid` role owns an element `tr` with implicit `row` role that in turn owns elements `td` with implicit `gridcell` roles.
181
+
182
+
```html
183
+
<tablerole="treegrid"aria-label="a test grid">
184
+
<tr>
185
+
<td>Item 1</td>
186
+
<td>Item 2</td>
187
+
<td>Item 3</td>
188
+
</tr>
189
+
</table>
190
+
```
191
+
142
192
### Failed
143
193
144
194
#### Failed Example 1
@@ -225,6 +275,43 @@ This element with the `list` role owns an element with the `listitem` role and a
225
275
</div>
226
276
```
227
277
278
+
#### Failed Example 8
279
+
280
+
This element with the `menu` role owns `option` elements with implicit `option` role. The `option` role is not one of the [required owned elements][] for `menu`.
281
+
282
+
```html
283
+
<selectrole="menu"aria-label="a test menu">
284
+
<option>Item 1</option>
285
+
<option>Item 2</option>
286
+
<option>Item 3</option>
287
+
</select>
288
+
```
289
+
290
+
#### Failed Example 9
291
+
292
+
This element with the `menu` role owns `tr` elements with an explicit `list` role. The `list` role is not one of the [required owned elements][] for `menu`. In addition, the `tr` element with the explicit `list` role owns `td` elements with explicit `menuitem` roles. The `menuitem` role is not one of the [required owned elements][] for `list`.
293
+
294
+
```html
295
+
<tablerole="menu"aria-label="a test table"aria-activedescendant="item1"tabindex="0">
296
+
<trrole="list">
297
+
<tdid="item1"role="menuitem">Item 1</td>
298
+
<tdid="item2"role="menuitem">Item 2</td>
299
+
<tdid="item3"role="menuitem">Item 3</td>
300
+
</tr>
301
+
</table>
302
+
```
303
+
304
+
#### Failed Example 10
305
+
306
+
This element with the implicit `list` role owns an element with the implicit `generic` role. The `generic` role is not one of the [required owned elements][] for `list`. Note that this example is for demonstration purpose only because it's not a valid HTML 5 structure.
307
+
308
+
```html
309
+
<ul>
310
+
<div></div>
311
+
<div></div>
312
+
</ul>
313
+
```
314
+
228
315
### Inapplicable
229
316
230
317
#### Inapplicable Example 1
@@ -237,12 +324,12 @@ This element with the `list` role is not included in the accessibility tree beca
237
324
238
325
#### Inapplicable Example 2
239
326
240
-
This `ul` element does not have an [explicit semantic role][].
327
+
This `div` element with the `list` role is not included in the accessibility tree because it is hidden .
241
328
242
329
```html
243
-
<ul>
244
-
<li>Item 1</li>
245
-
</ul>
330
+
<divrole="list"hidden>
331
+
<divrole="listitem">Item 1</div>
332
+
</div>
246
333
```
247
334
248
335
#### Inapplicable Example 3
@@ -269,7 +356,6 @@ This element with the `menu` role has an `aria-busy` attribute set to `true`.
0 commit comments