diff --git a/__tests__/spelling-ignore.yml b/__tests__/spelling-ignore.yml index 8302098baa7..9028b983d59 100644 --- a/__tests__/spelling-ignore.yml +++ b/__tests__/spelling-ignore.yml @@ -8,6 +8,12 @@ - html - iframe - img +- ul +- ol +- dl +- li +- dd +- dt - frameset - h1 - h1-h6 @@ -32,6 +38,7 @@ - DOM - SVG - PDFs +- DPUB - url - voiceover - subtag @@ -95,6 +102,10 @@ - searchbox - treeitem - listbox +- listitem +- tablist +- tabpanel +- doc-biblioentry - textbox - autocomplete - textarea diff --git a/_rules/aria-required-context-role-ff89c9.md b/_rules/aria-required-context-role-ff89c9.md new file mode 100644 index 00000000000..2bfd0b32929 --- /dev/null +++ b/_rules/aria-required-context-role-ff89c9.md @@ -0,0 +1,229 @@ +--- +id: ff89c9 +name: ARIA required context role +rule_type: atomic +description: | + This rule checks that an element with an explicit semantic role exists inside its required context. +accessibility_requirements: + wcag20:1.3.1: # Info and Relationships (A) + forConformance: true + failed: not satisfied + passed: further testing needed + inapplicable: further testing needed +input_aspects: + - Accessibility tree + - DOM Tree +acknowledgements: + authors: + - Wilco Fiers + - Brian Bors + previous_authros: + - Anne Thyme Nørregaard +--- + +## Applicability + +The rule applies to any HTML or SVG element that is [included in the accessibility tree](#included-in-the-accessibility-tree) and has a [WAI-ARIA 1.1](https://www.w3.org/TR/wai-aria-1.1/) [explicit semantic role](#explicit-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](#implicit-role) that is identical to its [explicit semantic role](#explicit-role). + +**Note:** An example of an element that has a [WAI-ARIA required context role](https://www.w3.org/TR/wai-aria-1.1/#scope) is `tab` that has `tablist` as a [required context role](https://www.w3.org/TR/wai-aria-1.1/#scope). + +**Note:** An example of an element that has an [implicit semantic role](#implicit-role) that is identical to its [explicit semantic role](#explicit-role) is an `li` element that has `role="listitem"`. These elements are not applicable. + +**Note:** The applicability of this rule is limited to only the [WAI-ARIA 1.1 Recommendation](https://www.w3.org/TR/wai-aria-1.1/) roles, since there are unresolved issues with how [Digital Publishing WAI-ARIA Module (DPUB ARIA) 1.0](https://www.w3.org/TR/dpub-aria-1.0/) uses role inheritance to define the [required context roles](https://www.w3.org/TR/wai-aria-1.1/#scope), which makes it deviate from the model defined in [WAI-ARIA 1.1](https://www.w3.org/TR/wai-aria-1.1/). The [WAI-ARIA Graphics Module](https://www.w3.org/TR/graphics-aria-1.0/) does not include any [required context roles](https://www.w3.org/TR/wai-aria-1.1/#scope). + +## Expectation + +Each test target is [owned by](#owned-by) an element that has a [semantic role](#semantic-role) that is one of the [WAI-ARIA required context roles](https://www.w3.org/TR/wai-aria-1.1/#scope) of the target element. + +**Note:** The definition of [owned by](#owned-by) used in this rule is different than the definition of ["owned element" in WAI-ARIA](https://www.w3.org/TR/wai-aria-1.1/#dfn-owned-element). See more in the [owned by](#owned-by) definition. + +**Note:** [Subclass roles](https://www.w3.org/TR/wai-aria-1.1/#subclassroles) of [WAI-ARIA required context roles](https://www.w3.org/TR/wai-aria-1.1/#scope) are not automatically included as possible [required context roles](https://www.w3.org/TR/wai-aria-1.1/#scope). E.g. the [`feed`](https://www.w3.org/TR/wai-aria-1.1/#feed) role is not a possible [required context role](https://www.w3.org/TR/wai-aria-1.1/#scope) for [`listitem`](https://www.w3.org/TR/wai-aria-1.1/#listitem), even though [`feed`](https://www.w3.org/TR/wai-aria-1.1/#feed) is a [subclass role](https://www.w3.org/TR/wai-aria-1.1/#subclassroles) of the [`list`](https://www.w3.org/TR/wai-aria-1.1/#list) role. + +## Assumptions + +If the [explicit semantic role](#explicit-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/WCAG21/#info-and-relationships). + +## Accessibility Support + +- User agents do not all have the same accessibility tree. Particularly the method of deriving which element owns which other elements varies between browsers. This can lead to different results for this rule, depending on which accessibility tree is used as input. +- `aria-owns` has limited support in some user agents. + +## Background + +- [Understanding Success Criterion 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html) +- [Required Context Role](https://www.w3.org/TR/wai-aria-1.1/#scope) + +## Test Cases + +### Passed + +#### Passed Example 1 + +Element with [explicit semantic role](#explicit-role) `listitem` is contained within its [required context role](https://www.w3.org/TR/wai-aria-1.1/#scope) `list`, expressed as an [explicit semantic role](#explicit-role). + +```html +
+
List item 1
+
+``` + +#### Passed Example 2 + +Element with [explicit semantic role](#explicit-role) `listitem` is contained within its [required context role](https://www.w3.org/TR/wai-aria-1.1/#scope) `list`, through the [implicit semantic role](#implicit-role) of `ul`. + +```html + +``` + +#### Passed Example 3 + +Element contained within its [required context role](https://www.w3.org/TR/wai-aria-1.1/#scope) even though it is not a direct child of the [context role](https://www.w3.org/TR/wai-aria-1.1/#scope). + +```html +
+
+
List item 1
+
+
+``` + +#### Passed Example 4 + +`aria-owns` used to give the target element the right [context role](https://www.w3.org/TR/wai-aria-1.1/#scope). + +```html +
+
List item 1
+``` + +#### Passed Example 5 + +The `aria-owns` attribute override normal DOM tree relationship. Thus, the innermost `div` element (`item`) is not owned by the intermediate one (with a `role="navigation"`) and has the correct [context role](https://www.w3.org/TR/wai-aria-1.1/#scope). + +```html +
+
+
List item 1
+
+
+``` + +#### Passed Example 6 + +Since implicit ownership can cross shadow boundaries, the element with the [explicit semantic role](#explicit-role) of `listitem` is contained within its [required context role](https://www.w3.org/TR/wai-aria-1.1/#scope) of `list`. + +```html +
+ + +``` + +### Failed + +#### Failed Example 1 + +The `listitem` has no [context role](https://www.w3.org/TR/wai-aria-1.1/#scope). + +```html +
List item 1
+``` + +#### Failed Example 2 + +The `listitem` is owned by the `tabpanel`, because it is the closest ancestor, but `tabpanel` is not the correct [context](https://www.w3.org/TR/wai-aria-1.1/#scope) for `listitem`. + +```html +
+
+
List item 1
+
+
+``` + +#### Failed Example 3 + +The `listitem` is owned by the `aria-label="menu"` div, rather than the `list`. + +```html +
+
+
List item 1
+
+
+``` + +#### Failed Example 4 + +Since explicit ownership cannot cross shadow boundaries, the element with the [explicit semantic role](#explicit-role) of `listitem` does not have a [context role](https://www.w3.org/TR/wai-aria-1.1/#scope). + +```html +
+ +
+ + +``` + +### Inapplicable + +#### Inapplicable Example 1 + +There is no element with an [explicit semantic role](#explicit-role). + +```html + +``` + +#### Inapplicable Example 2 + +The `listitem` is not [included in the accessibility tree](#included-in-the-accessibility-tree). + +```html +
List item 1
+``` + +#### Inapplicable Example 3 + +The `header` role does not have a [required context role](https://www.w3.org/TR/wai-aria-1.1/#scope). + +```html +
Hello!
+

Welcome to my homepage!

+``` + +#### Inapplicable Example 4 + +The `listitem` has an [explicit semantic role](#explicit-role), but it is identical to the [implicit semantic role](#implicit-role), making the element inapplicable. + +```html + +``` + +#### Inapplicable Example 5 + +The `doc-biblioentry` has a role from the [Digital Publishing WAI-ARIA Module (DPUB ARIA) 1.0](https://www.w3.org/TR/dpub-aria-1.0/), not the [WAI-ARIA 1.1 Recommendation](https://www.w3.org/TR/wai-aria-1.1/), and it is therefore inapplicable. + +```html +
+

Cited Works

+
+

+ John Steinbeck, The Grapes of Wrath (New York: The Viking Press, 1939) +

+
+
+``` diff --git a/pages/glossary/owned-by.md b/pages/glossary/owned-by.md new file mode 100644 index 00000000000..f60ad0cc598 --- /dev/null +++ b/pages/glossary/owned-by.md @@ -0,0 +1,8 @@ +--- +title: Owned by +key: owned-by +--- + +An element A is owned by element B if element A is a child of element B in the [accessibility tree](https://www.w3.org/TR/act-rules-aspects/#input-aspects-accessibility). + +> **Note:** This definition is different from the definition of ["owned element" in WAI-ARIA](https://www.w3.org/TR/wai-aria-1.1/#dfn-owned-element). Because browsers have different accessibility trees, which element owns which other elements can vary between browsers. Until there is a standard accessibility tree, testing with multiple accessibility trees may be necessary.