|
| 1 | +--- |
| 2 | +id: kb1m8s |
| 3 | +name: ARIA global properties not used where prohibited |
| 4 | +rules_format: 1.1 |
| 5 | +rule_type: atomic |
| 6 | +description: | |
| 7 | + This rule checks that global WAI-ARIA properties are not on elements whose role prohibits them. |
| 8 | +accessibility_requirements: |
| 9 | + aria12:prohibitedattributes: |
| 10 | + title: ARIA 1.2, 5.2.5 Prohibited States and Properties |
| 11 | + forConformance: true |
| 12 | + failed: not satisfied |
| 13 | + passed: satisfied |
| 14 | + inapplicable: satisfied |
| 15 | + wcag-technique:ARIA5: # Using WAI-ARIA state and property attributes to expose the state of a user interface component |
| 16 | + forConformance: false |
| 17 | + failed: not satisfied |
| 18 | + passed: further testing needed |
| 19 | + inapplicable: further testing needed |
| 20 | + wcag20:1.3.1: # Info and Relationships (A) |
| 21 | + secondary: This success criterion is **less strict** than this rule. This is because the rule does not ignore irrelevant ARIA properties. Some of the failed examples satisfy this success criterion. |
| 22 | +input_aspects: |
| 23 | + - Accessibility Tree |
| 24 | + - CSS styling |
| 25 | + - DOM Tree |
| 26 | +acknowledgments: |
| 27 | + authors: |
| 28 | + - Wilco Fiers |
| 29 | + previous_authors: |
| 30 | + - Anne Thyme Nørregaard |
| 31 | + - Jean-Yves Moyen |
| 32 | +--- |
| 33 | + |
| 34 | +## Applicability |
| 35 | + |
| 36 | +This rule applies to any [WAI-ARIA global state or property][global] that is specified on an [HTML or SVG element][namespaced element] that is [included in the accessibility tree][]. |
| 37 | + |
| 38 | +## Expectation |
| 39 | + |
| 40 | +The test target is not [prohibited][] for the [semantic role][] of the element on which it is specified. |
| 41 | + |
| 42 | +## Background |
| 43 | + |
| 44 | +The presence of prohibited ARIA attributes is often the result of a developer using an incorrect role, or a misunderstanding of the attribute. These attributes are ignored by browsers and other assistive technologies. This often means that a state or property which should exist is missing. |
| 45 | + |
| 46 | +In HTML, there are language features that do not have corresponding implicit WAI-ARIA semantics. As per [ARIA in HTML](https://www.w3.org/TR/html-aria/), those elements can have [global states or properties][global]. Some of those elements can also have [inherited][], [supported][], or [required][] [states][state] or [properties][property] that correspond to a [WAI-ARIA role](https://www.w3.org/TR/wai-aria-1.2/#introroles). For example, the `audio` element has no corresponding ARIA semantics but it can have [inherited][], [supported][], or [required][] [states][state] or [properties][property] of the [`application` role](https://www.w3.org/TR/wai-aria-1.2/#application). |
| 47 | + |
| 48 | +### Assumptions |
| 49 | + |
| 50 | +There are no assumptions. |
| 51 | + |
| 52 | +### Accessibility Support |
| 53 | + |
| 54 | +Browsers and assistive technologies behave differently when prohibited attributes are used. Some may assign a role so that the property is available to assistive technologies, where others ignore the attribute. |
| 55 | + |
| 56 | +Implementation of [Presentational Roles Conflict Resolution][] varies from one browser or assistive technology to another. Depending on this, some elements can have a [semantic role][] of `none` and their attributes fail this rule with some technologies but users of other technology would not experience any accessibility issue. |
| 57 | + |
| 58 | +### Related rules |
| 59 | + |
| 60 | +- [ARIA state or property is permitted](https://www.w3.org/WAI/standards-guidelines/act/rules/5c01ea/) |
| 61 | +- [ARIA state or property has valid value](https://www.w3.org/WAI/standards-guidelines/act/rules/6a7281/) |
| 62 | + |
| 63 | +### Bibliography |
| 64 | + |
| 65 | +- [Understanding Success Criterion 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html) |
| 66 | +- [Understanding Success Criterion 4.1.2: Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) |
| 67 | +- [WAI-ARIA 1.2, Prohibited States and Properties](https://www.w3.org/TR/wai-aria/#prohibitedattributes) |
| 68 | +- [WAI-ARIA 1.2, Global States and Properties](https://www.w3.org/TR/wai-aria-1.2/#global_states) |
| 69 | +- [ARIA5: Using WAI-ARIA state and property attributes to expose the state of a user interface component](https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA5) |
| 70 | + |
| 71 | +## Examples |
| 72 | + |
| 73 | +### Passed |
| 74 | + |
| 75 | +#### Passed Example 1 |
| 76 | + |
| 77 | +This generic `div` element is allowed the global `aria-live` property. |
| 78 | + |
| 79 | +```html |
| 80 | +<div aria-live="polite">I like Bananas</div> |
| 81 | +``` |
| 82 | + |
| 83 | +#### Passed Example 2 |
| 84 | + |
| 85 | +This `a` element with an [implicit role][] of `link` is allowed the `aria-label` property. |
| 86 | + |
| 87 | +```html |
| 88 | +<a href="#" aria-label="Previously 100, now 1 euro"> <s>€100</s> / <b>€1</b> </a> |
| 89 | +``` |
| 90 | + |
| 91 | +#### Passed Example 3 |
| 92 | + |
| 93 | +This `div` element is allowed the `aria-braillelabel` property because its [explicit role][] of `heading` does not prohibit this. |
| 94 | + |
| 95 | +```html |
| 96 | +<div role="heading" aria-braillelabel="I like bananas"> |
| 97 | + I ❤️ Bananas |
| 98 | +</div> |
| 99 | +``` |
| 100 | + |
| 101 | +### Failed |
| 102 | + |
| 103 | +#### Failed Example 1 |
| 104 | + |
| 105 | +The `aria-label` property is [prohibited][] for an element with a `generic` role. |
| 106 | + |
| 107 | +```html |
| 108 | +<div aria-label="Previously 100, now 1 euro"><s>€100</s> / <b>€1</b></div> |
| 109 | +``` |
| 110 | + |
| 111 | +#### Failed Example 2 |
| 112 | + |
| 113 | +The `aria-labelledby` property is [prohibited][] for an element with a `paragraph` role. |
| 114 | + |
| 115 | +```html |
| 116 | +<h1 id="bananas">I like bananas</h1> |
| 117 | +<p aria-labelledby="Bananas">🧑 ❤️ 🍌🍌</p> |
| 118 | +``` |
| 119 | + |
| 120 | +#### Failed Example 3 |
| 121 | + |
| 122 | +The `aria-braillelabel` property is [prohibited][] for an element with a `button` role. |
| 123 | + |
| 124 | +```html |
| 125 | +<p aria-braillelabel="I love Bananas">I ❤️ Bananas</p> |
| 126 | +``` |
| 127 | + |
| 128 | +#### Failed Example 4 |
| 129 | + |
| 130 | +The `aria-roledescription` property is [prohibited][] for an element with a `generic` role. |
| 131 | + |
| 132 | +```html |
| 133 | +<div aria-roledescription="Banana text">I like bananas</div> |
| 134 | +``` |
| 135 | + |
| 136 | +#### Failed Example 5 |
| 137 | + |
| 138 | +The `aria-brailleroledescription` property is [prohibited][] for an element with a `none` role. |
| 139 | + |
| 140 | +```html |
| 141 | +<h1 role="none" aria-brailleroledescription="Banana text">I like bananas</h1> |
| 142 | +``` |
| 143 | + |
| 144 | +### Inapplicable |
| 145 | + |
| 146 | +#### Inapplicable Example 1 |
| 147 | + |
| 148 | +The generic `div` element is hidden. |
| 149 | + |
| 150 | +```html |
| 151 | +<div aria-label="Bananas" hidden></div> |
| 152 | +``` |
| 153 | + |
| 154 | +[explicit role]: #explicit-role 'Definition of Explicit Role' |
| 155 | +[global]: https://www.w3.org/TR/wai-aria-1.2/#global_states 'Definition of Global ARIA States and Properties' |
| 156 | +[included in the accessibility tree]: #included-in-the-accessibility-tree 'Definition of Included in the Accessibility Tree' |
| 157 | +[inherited]: https://www.w3.org/TR/wai-aria-1.2/#inheritedattributes 'Definition of Inherited ARIA States and Properties' |
| 158 | +[presentational roles conflict resolution]: https://www.w3.org/TR/wai-aria-1.2/#conflict_resolution_presentation_none 'Presentational Roles Conflict Resolution' |
| 159 | +[property]: https://www.w3.org/TR/wai-aria-1.2/#dfn-property 'Definition of ARIA Property' |
| 160 | +[required]: https://www.w3.org/TR/wai-aria-1.2/#requiredState 'Definition of Required ARIA States and Properties' |
| 161 | +[semantic role]: #semantic-role 'Definition of Semantic Role' |
| 162 | +[state]: https://www.w3.org/TR/wai-aria-1.2/#dfn-state 'Definition of ARIA State' |
| 163 | +[supported]: https://www.w3.org/TR/wai-aria-1.2/#supportedState 'Definition of Supported ARIA States and Properties' |
| 164 | +[namespaced element]: #namespaced-element |
| 165 | +[prohibited]: https://www.w3.org/TR/wai-aria-1.2/#prohibitedattributes 'WAI-ARIA 1.2 Definition of Prohibited States and Properties' |
0 commit comments