Role has required states and properties

  • Rule Typeatomic
  • Rule ID: 4e8ab6
  • Last modified: Aug 21, 2019
  • Accessibility Requirements Mapping
    • 4.1.2 Name, Role, Value (Level: A)
      • Learn More about 4.1.2 (Name, Role, Value)
      • Required for conformance to WCAG 2.0 and above on level A and above
      • Outcome mapping:
        • Any failed outcomes: not satisfied
        • All passed outcomes: further testing is needed
        • An inapplicable outcome: further testing is needed
  • Input Aspects

Description

This rule checks that elements that have an explicit role also specify all required states and properties.

Applicability

Any HTML or SVG element that has an explicit semantic role, except if the element has an implicit semantic role that is identical to the explicit semantic role.

Expectation

For each test target, the WAI-ARIA required states and properties for the role are present, unless the state or property has a default value listed under WAI-ARIA implicit value for role.

Note: This rule does not test whether the required states and properties have correct values, only that the attributes are present and are not empty ("").

Assumptions

Accessibility Support

This rule relies on browsers and assistive technologies to support leaving out WAI-ARIA required states and properties when a WAI-ARIA implicit value for role is specified in WAI-ARIA 1.1.

Note: The required states and properties with implicit values can be found in the Core Accessibility API Mappings 1.1 Overview of default values for missing required attributes.

Background

Test Cases

Passed

Passed Example 1

Element has required states (no properties required for this role)

<div role="option" aria-selected="false"></div>

Passed Example 2

Implicit value for roles: option role has an implicit value (false) specified for the required state aria-selected

<div role="option"></div>

Passed Example 3

Implicit value for roles: option role has an implicit value (false) specified for the required state aria-selected, here defined without value

<div role="option" aria-selected></div>

Passed Example 4

Implicit value for roles: option role has an implicit value (false) specified for the required state aria-selected, here defined with only whitespace instead of a value

<div role="option" aria-selected=" "></div>

Passed Example 5

Element has required properties, and required state aria-expanded has an implicit value

<div role="combobox" aria-controls="someElementId"></div>

Passed Example 6

Element has required properties, but with incorrect value since no element with with the given id(s) exists in the document

<div role="combobox" aria-controls="foo"></div>

Failed

Failed Example 1

Element does not list required states and properties (aria-controls is required property for combobox)

<div role="combobox"></div>

Failed Example 2

Required states and properties do not have a value that is not empty ("")

<div role="combobox" aria-controls=""></div>

Inapplicable

Inapplicable Example 1

Element does not have a semantic role

<div>Some Content</div>

Inapplicable Example 2

Element does not have an explicit semantic role

<nav></nav>

Inapplicable Example 3

Element has an implicit semantic role that is identical to the explicit semantic role

<input type="checkbox" role="checkbox" />

Inapplicable Example 4

Element does not list required states and properties (aria-controls is required property for combobox), but the element is not included in the accessibility tree

<div role="combobox" style="display:none;"></div>

Glossary

Explicit Semantic Role

key: explicit-role

The explicit semantic role is the semantic role of an element set by its role attribute.

The role attribute takes a list of tokens. The explicit semantic role is the first valid role in this list. If none of the tokens are valid, the implicit semantic role will be used instead.

Non-abstract roles defined in the following specifications are considered valid:

Other roles may be added as they become available. Not all roles will be supported in all assistive technologies. Testers are encouraged to adjust which roles are allowed according to the accessibility support base line. For the purposes of executing test cases in all rules, it should be assumed that all roles are supported by assistive technologies so that none of the roles fail due to lack of accessibility support.

Acccessibility Support

Some browsers and assistive technologies treat the tokens of the role attribute as case-sensitive. Unless lowercase letters are used for the value of the role attribute, not all user agents will be able to interpret the tokens correctly. ARIA in HTML also specifies that authors must use lowercase letters for the role and aria-* attributes (work in progress).

Implicit Semantic Role

key: implicit-role

The Implicit Semantic Role is the semantic role of each element that is used when no valid explicit semantic role is specified. Elements with no role attribute, or with a role attribute containing no valid token, are mapped to their implicit role.

Implicit roles for HTML and SVG, are documented in the HTML accessibility API mappings (work in progress), the ARIA in HTML (work in progress) documentation, and the SVG accessibility API mappings (work in progress).

Outcome

key: outcome

A conclusion that comes from evaluating an ACT Rule on a test subject or one of its constituent test target. An outcome can be one of the three following types:

  • Inapplicable: No part of the test subject matches the applicability
  • Passed: A test target meets all expectations
  • Failed: A test target does not meet all expectations

Note: A rule has one passed or failed outcome for every test target. When there are no test targets the rule has one inapplicable outcome. This means that each test subject will have one or more outcomes.

Note: Implementers using the EARL10-Schema can express the outcome with the outcome property. In addition to passed, failed and inapplicable, EARL 1.0 also defined an incomplete outcome. While this cannot be the outcome of an ACT Rule when applied in its entirety, it often happens that rules are only partially evaluated. For example, when applicability was automated, but the expectations have to be evaluated manually. Such "interim" results can be expressed with the incomplete outcome.


Changelog

Aug 21, 2019fix: update links to WCAG21 resources (#776)
Aug 21, 2019Editorial changes (#725)
Aug 14, 2019feat: Define implicit/explicit role (4e8ab6, b20e66, c487ae, e086e5, 5c01ea) (#689)
Jul 26, 2019Editorial changes (#702)
Jul 17, 2019fix: test if definition for all referenced glossary terms exist (#634)
May 15, 2019Glossary and Rule update: Replacing "non-empty" definition (#430)
May 9, 2019Chore: Adapt site to ACT Rules CR format (#547)
May 7, 2019Template update - Role has required states and properties (#527)
Apr 29, 2019chore: rename files and update associations (#489)
Apr 16, 2019chore: add unique id to all rules (#478)
Apr 15, 2019chore: WCAG ACT RULES CG Website Update (#437)
Apr 10, 2019Rule update: "aria attribute allowed" and "aria required states and properties" (#436)
Mar 2, 2019fix: add assumptions to rules (#402)
Oct 30, 2018Remove CSS Styling from test_aspects where not used (#304)
Oct 3, 2018Rule: SC4-1-2-role-has-required-states-and-properties (#167)

Useful Links


Implementations

Tool NameCreated ByReport
AlfaSiteimproveView Report

Acknowledgements