-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule: ARIA required context role (ff89c9) #255
Changes from 21 commits
4b2cd9a
bdbfbeb
f80607d
409bb9a
8f79ac6
4f4701d
7b43dde
2ac617f
ded2be6
8a81b50
1542f48
b9b79a8
8bf6038
dfc56b2
c2ccbc1
35d480e
9835b44
d92d89c
16f50c7
47e4ce5
96472af
0785f09
9c81dcd
52a4b1e
4339973
5c7b137
127beb4
473016f
b952555
dc50845
542090d
31a7bf1
576eb0d
c031c89
8d08752
08069fa
7578413
b360785
4b13b65
922d3e8
33d0f44
e9f8a8a
1a6d693
9a6da41
6839767
376ce5f
9b73e57
87777d3
476a2e6
4ff8e00
b7e25e0
c41e314
78169f8
ee977ac
c41dfe3
8f62229
32b92de
07ba91a
191b5cc
c4e760e
f152e32
8262e3a
4efedba
1af2679
45f5648
ca84d89
89aee3c
f4f5188
5b45798
e3db62e
5cbc373
7362c00
5db02eb
b8519e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
--- | ||
name: ARIA required context role | ||
description: | | ||
This rule checks that a role does not exist outside of its required context roles | ||
|
||
success_criterion: | ||
- 1.3.1 # Info and Relationships | ||
|
||
test_aspects: | ||
- DOM Tree | ||
- CSS Styling | ||
|
||
authors: | ||
- Anne Thyme Nørregaard | ||
--- | ||
|
||
## Test procedure | ||
|
||
### Applicability | ||
|
||
The rule applies to any HTML or SVG element that is [included in the accessibility tree](#included-in-the-accessibility-tree) and has an explicit [semantic role](#semantic-role) with a [WAI-ARIA required context role](https://www.w3.org/TR/wai-aria-1.1/#scope), except if the element has an implicit semantic role that is identical to its explicit semantic role. | ||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
WilcoFiers marked this conversation as resolved.
Show resolved
Hide resolved
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Editorial: Add an example to clarify the last point:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Example added, but as a note to keep normative and informative parts of the rule seperate. |
||
|
||
### Expectation | ||
|
||
The [owner element](owner-element) for each target element has a [semantic role](#semantic-role) matching one of the [WAI-ARIA required context roles](https://www.w3.org/TR/wai-aria-1.1/#scope) for the target element. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should put in an example here. Maybe just add something like "(e.g. listitem is owned by a list)". This sentence is all Auto-WCAG and ARIA jargon. This might help explain it. |
||
|
||
## Assumptions | ||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong. |
||
|
||
_There are currently no assumptions_ | ||
|
||
## Accessibility Support | ||
|
||
This rule relies on assistive technologies to recognize [owner elements](#owner-element). This includes when the owner elements are ancestors that are not parents of the target element. However, some assistive technologies do not recognize owner elements that are not parents, unless workarounds are used. | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
Furthermore, `aria-owns` has limited support in user agents. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "in user agents" -> "in some user agents" |
||
|
||
## Background | ||
|
||
- [Required Context Role](https://www.w3.org/TR/wai-aria-1.1/#scope) | ||
|
||
## Test Cases | ||
|
||
### Passed | ||
|
||
#### Passed example 1 | ||
|
||
Element with role `listitem` is contained within its required context role `list`, expressed as an explicit role. | ||
|
||
```html | ||
<div role="list"> | ||
<div role="listitem"></div> | ||
</div> | ||
``` | ||
|
||
#### Passed example 2 | ||
|
||
Element with role `listitem` is contained within its required context role `list`, through the implicit role of `ul`. | ||
|
||
```html | ||
<ul> | ||
<div role="listitem"></div> | ||
</ul> | ||
``` | ||
|
||
#### Passed example 3 | ||
|
||
Element contained within its required context role even though it is not a direct child of the context role. | ||
|
||
```html | ||
<div role="list"> | ||
<div> | ||
<div> | ||
<div> | ||
<div role="listitem"></div> | ||
jeeyyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
<div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two |
||
<div> | ||
</div> | ||
``` | ||
|
||
#### Passed example 4 | ||
|
||
`aria-owns` used to give the target element the right context role. | ||
|
||
```html | ||
<div role="list" aria-owns="id1"> | ||
<div role="tabpanel"> | ||
<div id="id1" role="listitem"></div> | ||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the Example 5, I put text in the list item and I expected that VO reads "a list with 1 item". But it doesn't give us the semantic of the element. <div role="list" aria-owns="id1 id2">
<div>Follow a list</div>
<div id="id1" role="listitem">Lista 1</div>
<div id="id2" role="listitem">Lista 2</div>
</div> With VO: how many items in the list? 3. I expected 2. Either w/ a more natural building, VO doesn't recognise the aria-owns: <h2>Test 1: 1 native nested list w/ native relation</h2>
<ul>
<li>Fruts
<ul>
<li>Apples</li>
<li>Bananas</li>
</ul>
</li>
<li>Vegetables</li>
</ul>
<h2>Teste 2: 2 native lists w/ relations through aria-owns</h2>
<ul>
<li aria-owns="child">Fruts</li>
<li>Vegetables</li>
</ul>
<ul id="child">
<li>Apples</li>
<li>Bananas</li>
</ul>
<h2>Test 3: 2 non-native lists + relations through aria-owns and list semantic through ARIA</h2>
<div role="list">
<div role="listitem" aria-owns="fruit">Fruts</div>
<div role="listitem">Vegetables</div>
</div>
<div role="list" id="fruit">
<div role="listitem">Apples</div>
<div role="listitem">Bananas</div>
</div> VO do not recognise the relations neither in test 2 nor test 3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jorgeponto, do you think this is covered well enough in the current Accessibility support section? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kasperisager and I discussed this, and we feel that it is covered through the following sections:
"Owned by" definition:
I am going to gamble, and go ahead and take this rule into Final Call, while waiting for @jorgeponto to get back on this. |
||
</div> | ||
</div> | ||
``` | ||
|
||
### Failed | ||
|
||
#### Failed example 1 | ||
|
||
No context role. | ||
|
||
```html | ||
<div role="listitem"></div> | ||
``` | ||
|
||
#### Failed example 2 | ||
|
||
Wrong context role | ||
|
||
```html | ||
<div role="tablist"> | ||
<div role="listitem"></div> | ||
</div> | ||
``` | ||
|
||
#### Failed example 3 | ||
|
||
Element not contained within its required context role. | ||
|
||
```html | ||
<div role="list"></div> | ||
<div role="listitem"></div> | ||
``` | ||
|
||
#### Failed example 4 | ||
|
||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong. |
||
Element with role `listitem` has a closer ancestor, that is included in the accessibility tree, than the role `list` that should have been its context role | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we should have Failed example 5 and 7 in here. I agree, these are correct, but given that we're going outside standards land I think we should be a little forgiving about tools that don't have an owned elements implementation that works exactly the way we've defined owned element. I'd prefer to remove this, but if you feel strongly about it, leave them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to make it very explicit what the consequences of our definition is, and then have a discussion about it, if people disagree, rather than having it be a big blur, where everyone can have their own interpretation... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers, I have added notes for the two test cases in question (now Failed example 4+6) and for the Expectation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My preference is to remove them, but since you're the author, I'll leave it up to you. |
||
|
||
```html | ||
<div role="list"> | ||
<div aria-label="menu"> | ||
<div role="listitem"></div> | ||
<div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be |
||
</div> | ||
``` | ||
|
||
#### Failed example 5 | ||
|
||
Element with role `listitem` has a closer ancestor, that is included in the accessibility tree, than the role `list` that should have been its context role | ||
|
||
```html | ||
<div role="list"> | ||
<div role="tabpanel"> | ||
<div role="listitem"></div> | ||
</div> | ||
</div> | ||
``` | ||
|
||
#### Failed example 6 | ||
|
||
The owner element is the first element that references the target element through `aria-owns`, which results in the wrong context role. | ||
|
||
```html | ||
<div role="tabpanel" aria-owns="id1"> | ||
<div role="list" aria-owns="id1"> | ||
<div id="id1" role="listitem"></div> | ||
</div> | ||
</div> | ||
``` | ||
|
||
### Inapplicable | ||
|
||
#### Inapplicable example 1 | ||
|
||
Element does not have an explicit semantic role | ||
|
||
```html | ||
<ul></ul> | ||
``` | ||
|
||
#### Inapplicable example 2 | ||
|
||
Element is not exposed to assistive technologies. | ||
|
||
```html | ||
<div role="tab" aria-hidden="true"></div> | ||
``` | ||
|
||
#### Inapplicable example 3 | ||
|
||
Role does not have any required context roles listed in WAI-ARIA spec. | ||
|
||
```html | ||
<div role="radio"></div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per the #546 , this test case is missing an accessible name to conform to SC 1.3.1 . Moreover, the Proposal <label for="control-radio"> A radio control</label>
<div role="radio" aria-checked="true" id="control-radio"></div> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say it actually doesn't. The rule Form field has an accessible name is only for 4.1.2. It's not that I don't want to put it on, but then at least also the |
||
``` | ||
|
||
#### Failed example 4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Failed => Inapplicable |
||
|
||
Element is not exposed to assistive technologies, since decendant has `aria-hidden` attribute with value set to `true`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. decendant > descendant There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not the "descendant" but the "parent" that has the aria-hidden property no? |
||
|
||
```html | ||
<div role="list" aria-hidden="true"> | ||
<div role="listitem"></div> | ||
</div> | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,21 @@ title: Included in the accessibility tree | |
key: included-in-the-accessibility-tree | ||
--- | ||
|
||
Elements included in the accessibility tree of platform specific accessibility APIs. Elements in the accessibility tree are exposed to assistive technologies, allowing users to interact with the elements in a way that meet the requirements of the individual user. | ||
Elements included in the accessibility tree of platform specific accessibility APIs. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this say "DOM Nodes" instead of "Elements"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Researched to see which wording is used elsewhere, and found this definition of "accessible object", which may when matured into a recommendation replace our definition of "included in the accessibility tree": https://www.w3.org/TR/html-aam-1.0/#dfn-accessible-object There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "accessible object" is also a definition in Core Accessibility API Mappings 1.1, https://www.w3.org/TR/core-aam/#dfn-accessible-object, that is already a recommendation... |
||
|
||
The general rules for when elements are included in the accessibility tree are defined in the [core accessibility API mappings](https://www.w3.org/TR/core-aam/). For native markup languages, such as HTML and SVG, additional rules for when elements are [included in the accessibility tree][] can be found in the [HTML accessibility API mappings](https://www.w3.org/TR/html-aam/) and the [SVG accessibility API mappings](https://www.w3.org/TR/svg-aam/). | ||
Elements in the accessibility tree are exposed to assistive technologies, allowing users to interact with the elements in a way that meet the requirements of the individual user. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. r/meet/meets |
||
|
||
An element is included in the accessibility tree if it is a DOM node in the flattened DOM tree that meets the following criteria: | ||
|
||
1. It isn't hidden through WAI-ARIA or CSS, and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed "2. It does not have a semantic role of none or presentation, and" from @WilcoFiers' original suggestion at #302 (comment), since giving an element role There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we clarify aria-hidden, display:none or visibility:hidden? There are only 3 options here so maybe we can just include them. |
||
2. it has one or more of the following: | ||
* It has a [semantic role](#semantic-role), or | ||
* It has an accessible name that, when trimmed of whitespace, is not an empty string, or | ||
* it owns another element though an `aria-owns` attribute, or | ||
* It is owned by another element that references it with `aria-owns` | ||
|
||
> **Note:** Text nodes and pseudo elements can also be part of the accessibility tree, since they have their text content as the accessible name. | ||
|
||
The general rules for when elements are included in the accessibility tree are defined in the [core accessibility API mappings](https://www.w3.org/TR/core-aam/). For native markup languages, such as HTML and SVG, additional rules for when elements are [included in the accessibility tree](#included-in-the-accessibility-tree) can be found in the [HTML accessibility API mappings](https://www.w3.org/TR/html-aam/) and the [SVG accessibility API mappings](https://www.w3.org/TR/svg-aam/). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this paragraph needs to be here. These mapping documents describe how to map attributes to the accessibility APIs. It doesn't say much about which elements are and which aren't part of the accessibility tree. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers, I just looked into it, and it seems that the core-aam has some pretty neat guidance on when things should excluded from and included in the accessibility tree. Will check out the other two specs for relevance later... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers At least SVG AAM defines additional criteria for when elements are included in/excluded from the accessibility tree, see https://www.w3.org/TR/svg-aam/#include_elements and https://www.w3.org/TR/svg-aam/#exclude_elements. As such, SVG elements have different requirements than e.g. HTML for when accessible objects are created in the accessibility tree and do not fit the criteria currently listed. |
||
|
||
> **Note:** Users of assistive technologies might still be able to interact with elements that are not included in the accessibility tree. An example of this is a [focusable](#focusable) element with an `aria-hidden` attribute with a value of `true`. Such an element could still be interacted with using sequential keyboard navigation regardless of the assistive technologies used, even though the element would not be included in the accessibility tree. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ideally the file name should be |
||
title: Owner element | ||
key: owner-element | ||
--- | ||
|
||
|
||
If the node is referenced by an element through the `aria-owns` attribute, then the owner element is the first node in the DOM tree that references it through `aria-owns`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be "the first node in the DOM tree that is not hidden using WAI-ARIA or CSS and that references it through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers, first node, would that be traversing up through the DOM from the referencing/owned element? Or down from the top of the DOM tree? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depending on the answer for this, Failed example 7 might have to be changed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My interpretation of the Core Accessibility API mappings is that it is from the top of the DOM tree (which makes failed example 7 a fail). But I might be wrong since it is not explicit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @annethyme That's a good question. I would say that as long as the element is in the DOM, its "aria-owns" claim should persist, so that putting aria-hidden="true" on it means it and all its owned elements are considered hidden, and not cause its owned elements to change owner. I can easily see that being decided differently if this ever makes it to a standards group, but for now, my vote would be to keep what is here. It's also the simplest way to look at it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers, added a note reflecting your view on hiding the owner element's consequence for owned elements. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers, can you agree to what Carlos also said on this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Starting from the root node, yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kasperisager found this case that is not covered by the current definition: <html>
<body>
<div aria-owns="child">
Parent
</div>
<div id="child">
Child 1
</div>
<div id="child">
Child 2
</div>
</body>
</html> Parent owns Child 1 |
||
Otherwise, the owner element is the closest ancestor that is [included in the accessibility tree](#included-in-the-accessibility-tree). | ||
|
||
Nodes that are not included in the accessibility tree do not have an owner element. | ||
|
||
> **Note:** This definition is diverging from the definition of ["owned element" in WAI-ARIA](https://www.w3.org/TR/wai-aria-1.1/#dfn-owned-element). The reason is that the WAI-ARIA definition was found to provide too little guidance on how to handle specific edge cases where several elements compete about the ownership, and it seem that browser implementations of this are diverging a lot. This definition seeks to find a reasonable middle ground, but will have to be updated if the WAI-ARIA definition changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update to the new format.