Role attribute has valid value

  • Rule Typeatomic
  • Rule ID: 674b10
  • 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 each role attribute has a valid value.

Applicability

Any role attribute that is not empty (""), and that is specified on an HTML or SVG element that is included in the accessibility tree.

Note: Having a whitespace separated list of more than one token in the value of the role attribute is used for what is known as fallback roles. If the first token is not accessibility supported (or valid), the next one will be used for determining the semantic role of the element, and so forth.

Expectation

Each test target has a valid value that corresponds to a non-abstract WAI-ARIA role.

Note: Which specific roles to consider may depend on the type of content under test, such as web pages or digital publications, and are not limited to those defined by WAI-ARIA alone. Roles defined in separate WAI-ARIA modules, such as the Digital Publishing Module or the Graphics Module, may also be considered for this rule.

Assumptions

  • The ARIA role is being used to comply to WCAG.

Accessibility Support

Older browsers do not support more than one token in the value for a role attribute. If multiple values are used in the role attribute, the attribute is ignored in these browsers.

Background

Test Cases

Passed

Passed Example 1

Element with valid role value.

<input type="text" role="textbox" />

Passed Example 2

Element with multiple valid role values.

<span role="button link"></span>

Passed Example 3

Element with at least one valid role value.

<img role="img xyz" src="" />

Failed

Failed Example 1

Element with invalid role value.

<input role="invalid" value="123" />

Failed Example 2

Element with multiple invalid role value.

<input type="text" role="invalid role" />

Failed Example 3

Element with role attribute that is not empty (""), neither a valid role value.

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

Failed Example 4

Element with role attribute that is not empty (""), neither a valid role value.

<input type="text" role="#" />

Inapplicable

Inapplicable Example 1

Element with role attribute that is empty ("").

<div role="">Some Content</div>

Inapplicable Example 2

Element does not have role attribute.

<div>Some Content</div>

Inapplicable Example 3

Element with null role attribute.

<div role>Some Content</div>

Inapplicable Example 4

Element that is not included in the accessibility tree.

<div aria-hidden="true" role="banner">Some Content</div>

Glossary

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.

The general rules for when elements are included in the accessibility tree are defined in the core accessibility API mappings. 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 (work in progress) and the SVG accessibility API mappings (work in progress).

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 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.

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.

Semantic Role

key: semantic-role

A semantic role is a semantic association that indicates an object's type. This allows tools to present and support interaction with the object in a manner that is consistent with user expectations about other objects of that type.

The semantic role of an element is its explicit semantic role if it has any, otherwise, the implicit semantic role is used.


Changelog

Aug 21, 2019test: add tests to verify h4 headings (#810)
Aug 21, 2019Editorial changes (#725)
Jul 26, 2019Editorial changes (#702)
May 18, 2019chore: Validating rules frontmatter on CI (#551)
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 attribute has valid value (#526)
May 7, 2019Fix some incorrect test cases (#477)
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)
Mar 3, 2019fix: update rule type frontmatter (#427)
Mar 2, 2019fix: add assumptions to rules (#402)
Oct 29, 2018chore: change references to included in accessibility tree (#322)
Oct 24, 2018SC4-1-2-role-attribute-has-valid-value (#273)

Useful Links


Implementations

Tool NameCreated ByReport
AlfaSiteimproveView Report

Acknowledgements