diff --git a/_rules/status-text-has-aria-live-mogq50.md b/_rules/status-text-has-aria-live-mogq50.md new file mode 100644 index 00000000000..87f1b7e5144 --- /dev/null +++ b/_rules/status-text-has-aria-live-mogq50.md @@ -0,0 +1,525 @@ +--- +id: mogq50 +name: 'Status text update has `aria-live` property' +rule_type: atomic +description: | + This rule checks that any status message update has either "polite" or "assertive" `aria-live` property. +accessibility_requirements: + wcag21:4.1.3: # Status Messages (AA) + forConformance: true + failed: not satisfied + passed: further testing needed + inapplicable: further testing needed + wcag-technique:ARIA19: # Using ARIA role=alert or Live Regions to Identify Errors + forConformance: false + failed: not satisfied + passed: further testing needed + inapplicable: further testing needed + wcag-technique:ARIA22: # Using role=status to present status messages + forConformance: false + failed: not satisfied + passed: further testing needed + inapplicable: further testing needed + wcag-technique:ARIA23: # Using role=log to identify sequential information updates + forConformance: false + failed: not satisfied + passed: further testing needed + inapplicable: further testing needed +input_aspects: + - DOM Tree + - CSS Styling + - Accessibility Tree +acknowledgments: + authors: + - aron janecki + - jean-yves moyen +--- + +## Applicability + +This rule applies to any [text node][] that is a [descendant][] of the [HTML element][] in the [flat tree][] if the [text node][] is [included in the accessibility tree][] and at least one of the following is true: + +- **change**: the [text node][]'s [ancestor][]'s `innerText` property is changing; or +- **create**: the [text node][]'s [ancestor][] is either [appended](https://dom.spec.whatwg.org/#concept-node-append) or [inserted](https://dom.spec.whatwg.org/#concept-node-insert); or +- **replaced**: the [text node][]'s [ancestor][] was [replaced](https://dom.spec.whatwg.org/#concept-node-replace). + +## Expectation + +For each test target at least one of the following is true: + +- the test target has an accessible object as an ancestor in the accessibility tree with an implicit or explicit `aria-live` value of "assertive" or "polite"; or +- there is a text node with an equivalent message that has an accessible object as an ancestor in the accessibility tree with an implicit or explicit `aria-live` value of "assertive" or "polite". + +## Assumptions + +The text changes meet the definition of [status message][]. If this is not the case, success criterion [4.1.3 Status Messages][success criterion 4.1.3 status messages] may be satisfied even if this rule failed. + +This rule assumes that the [explicit role][] of the elements does not need to be appropriate to satisfy success criterion [4.1.3 Status Messages][success criterion 4.1.3 status messages]. For example, using `role="alert"` on elements with score updates may be of concern for success criterion [1.3.1 Info and Relationships][success criterion 1.3.1 info and relationships] because the `role="status"` appears to be more appropriate in such a context. + +This rule assumes that the changes happen within a 1 minute time span after the event firing and therefore the comparison between the page before and after the [event](https://dom.spec.whatwg.org/#concept-event) [firing](https://dom.spec.whatwg.org/#concept-event-fire) can be made at any time after that time span elapses. If there are changes after this time span, they may not be detected as [changes in content][event originated change in the content] and the rule may pass but [success criterion 4.1.3 Status Messages][] is not satisfied. The arbitrary 1 minute time span, selected so that testing this rule would not be impractical, is not included in WCAG. + +## Accessibility Support + +There exists a known combination of operating system and browsers that do not specify the implicit `aria-live` property. + +## Background + +- [ARIA19: Using ARIA role=alert or Live Regions to Identify Errors](https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA19.html) +- [ARIA21: Using role=status to present status messages](https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA22.html) +- [ARIA23: Using role=log to identify sequential information updates](https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA23.html) + +## Test Cases + +### Passed + +#### Passed Example 1 + +The `p` element that appears after activating submit button with no value for the first name field has `role="alert"`. `role="alert"` has an implicit `aria-live` value of "assertive". + +```html +
+ + + + + +``` + +#### Passed Example 2 + +This `p` element with `role="status"` has an implicit `aria-live` value of "polite". + +```html + + +Found phrases: 0
+ + + +++ + +``` + +#### Passed Example 3 + +The `p` element with `role="timer"` that appears after activating the "Download" `button` has an explicit `aria-live` value of "polite". `aria-live="polite"` overwrites the implicit value of "off" for elements with `role="timer"`. + +```html + + + + + +``` + +#### Passed Example 4 + +This `div` element with `role="log"` has an implicit `aria-live` value of "polite". + +```html + ++ "When appropriate roles or properties are assigned to status messages, the new content is spoken by screen readers + in such a way as to assist blind and low vision users. Most sighted users can observe text peripherally added to the + viewport. Such content provides additional information without affecting the user's current point of regard. The + ability of an assistive technology to announce such new important text content allows more users to benefit from an + awareness of the information in an equivalent manner." +
+
Press Activate Updates to receive live updates of stock values
+ + + +Company symbol | +Last price | +
---|---|
Comp1 | +0.675 | +
Comp2 | +0.543 | +
Found phrases: 0
+ +++ + +``` + +#### Failed Example 3 + +The `p` element with `role="timer"` that appears after activating the "Download" `button` has an implicit `aria-live` value of "off". The `aria-live="politeness"` is not a valid ARIA attribute which means that `aria-live` value of the test target defaults to "off". + +```html + + + +``` + +#### Failed Example 4 + +This `div` element does not have an implicit or explicit `aria-live` value of "polite" or "assertive". + +```html + + + + +``` + +### Inapplicable + +#### Inapplicable Example 1 + +This `p` element is not an [event originated change in the content][]. + +```html ++ "When appropriate roles or properties are assigned to status messages, the new content is spoken by screen readers + in such a way as to assist blind and low vision users. Most sighted users can observe text peripherally added to the + viewport. Such content provides additional information without affecting the user's current point of regard. The + ability of an assistive technology to announce such new important text content allows more users to benefit from an + awareness of the information in an equivalent manner." +
+
This is static text
+``` + +#### Inapplicable Example 2 + +This `p` element is not included in the accessibility tree through the `display: none` property. + +```html + +``` + +[ancestor]: https://dom.spec.whatwg.org/#concept-tree-ancestor 'Definition of ancestor' +[descendant]: https://dom.spec.whatwg.org/#concept-tree-descendant +[event originated change in the content]: https://act-rules.github.io/glossary/#changes-in-content 'Definition of changes in content' +[explicit role]: https://act-rules.github.io/glossary/#explicit-role 'Definition of explicit semantic role' +[flat tree]: https://drafts.csswg.org/css-scoping/#flat-tree 'Definition of flat tree' +[html element]: https://html.spec.whatwg.org/multipage/dom.html#htmlelement +[included in the accessibility tree]: #included-in-the-accessibility-tree 'Definition of included in the accessibility tree' +[status message]: https://www.w3.org/TR/WCAG21/#dfn-status-messages +[success criterion 1.3.1 info and relationships]: https://www.w3.org/TR/WCAG21/#info-and-relationships +[success criterion 4.1.3 status messages]: https://www.w3.org/TR/WCAG21/#status-messages +[text node]: https://dom.spec.whatwg.org/#text