Skip to content

Latest commit

 

History

History
executable file
·
258 lines (187 loc) · 9.27 KB

File metadata and controls

executable file
·
258 lines (187 loc) · 9.27 KB
id 4e8ab6
name Element with role attribute has required states and properties
rule_type atomic
description This rule checks that elements that have an explicit role also specify all required states and properties.
accessibility_requirements
wcag-technique:ARIA5 aria12:requiredState wcag20:1.3.1 wcag20:4.1.2
forConformance failed passed inapplicable
false
not satisfied
further testing needed
further testing needed
forConformance failed passed inapplicable
true
not satisfied
satisfied
satisfied
secondary
This success criterion is **less strict** than this rule. This is because browsers and assistive technologies will often fall back on a non-standard default value, which may be sufficient. Some of the failed examples may satisfy this success criterion.
secondary
This success criterion is **less strict** than this rule. This is because browsers and assistive technologies will often fall back on a non-standard default value, which may be sufficient. Some of the failed examples may satisfy this success criterion.
input_aspects
DOM Tree
acknowledgments
authors funding
Anne Thyme Nørregaard
Tom Brunet
WAI-Tools

Applicability

This rule applies to any HTML or SVG element that is included in the accessibility tree.

Expectation

For each test target, the WAI-ARIA required states and properties for the role are set and not empty ("").

The attributes may be explicitly set, implicitly set, or set by default.

Assumptions

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

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

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

Omitting WAI-ARIA required states and properties is often the result of a developer error. When required properties are missing and a default value is not specified by WAI-ARIA Specifications, the behavior is not defined. For WAI-ARIA 1.2, the only explicit semantic roles with a required property with a default value are the option and tabs roles for the aria-selected property.

The way the attribute is set doesn't matter for this rule. As long as authors can rely on User Agents or Assistive Technologies to set the attribute, this won't create problems for users. As per the First Rule of ARIA use, authors should rely on implicitly set attributes when possible.

Bibliography

Test Cases

Passed

Passed Example 1

This heading has the required aria-level property explicitly set.

<div role="heading" aria-level="1">
	My First Heading
</div>

Passed Example 2

This checkbox has the required aria-checked property explicitly set.

<div role="checkbox" aria-checked="false" aria-labelledby="label"></div>
<div id="label">Check me</div>

Passed Example 3

This scrollbar has the required properties aria-controls and aria-valuenow explicitly set. aria-valuemin has a default value of 0 and aria-valuemax of 100 and are thus set by default.

<div role="scrollbar" aria-controls="content" aria-valuenow="0"></div>
<main id="content"></main>

Passed Example 4

These option nodes have the required aria-selected property set by default.

<div id="label">Tags</div>
<ul role="listbox" aria-labelledby="label">
	<li role="option">Zebra</li>
	<li role="option">Zoom</li>
</ul>

Passed Example 5

This separator is not a widget because it is not focusable. The separator role does not have any required property when the element is not focusable.

<p>My first HTML</p>
<div role="separator"></div>
<p>My last HTML</p>

Passed Example 6

This combobox has the required properties aria-controls and aria-expanded explicitly set.

<label for="tag_combo">Tag</label>
<input type="text" id="tag_combo" role="combobox" aria-expanded="true" aria-controls="popup_listbox" />
<ul role="listbox" id="popup_listbox">
	<li role="option">Zebra</li>
	<li role="option" id="selected_option">Zoom</li>
</ul>

Passed Example 7

This checkbox has its required aria-checked property implicitly set.

<label>
	<input type="checkbox" />
	Check me
</label>

Passed Example 8

This menuitemcheckbox has its required aria-checked property implicitly set.

<label>
	<input type="checkbox" role="menuitemcheckbox" />
	Check me
</label>

Passed Example 9

This iframe element is included in the accessibility tree, even without a role, and therefore has no WAI-ARIA required states and properties.

<iframe srcdoc="<div>ACT rules are awesome!</div>" title="ACT rules" />

Failed

Failed Example 1

This heading does not have the required aria-level property. Prior to WAI-ARIA 1.2 the heading role had a default aria-level value of 2. As of WAI-ARIA 1.2 this property must be explicitly set.

<div role="heading">
	My First Heading
</div>

Failed Example 2

This switch does not have the required aria-checked property. Prior to WAI-ARIA 1.2 the switch role had a default aria-checked value of false. As of WAI-ARIA 1.2 this property must be explicitly set.

<div role="switch">
	Toggle me
</div>

Failed Example 3

This checkbox does not have the required property aria-checked. Prior to WAI-ARIA 1.2 the checkbox role had a default aria-checked value of false. As of WAI-ARIA 1.2 this property must be explicitly set.

<div role="checkbox" aria-labelledby="label"></div>
<div id="label">Check me</div>

Failed Example 4

This separator does not have the required aria-valuenow property. This is required because the separator is focusable, which makes it a widget.

<p>My first HTML</p>
<div role="separator" tabindex="0"></div>
<p>My last HTML</p>

Failed Example 5

This combobox does not have the required aria-expanded property. Prior to WAI-ARIA 1.2 the combobox had a default aria-expanded value of false. As of WAI-ARIA 1.2 this property must be explicitly set.

<label for="tag_combo">Tag</label>
<input type="text" id="tag_combo" role="combobox" aria-controls="popup_listbox" />
<ul role="listbox" id="popup_listbox">
	<li role="option">Zebra</li>
	<li role="option" id="selected_option">Zoom</li>
</ul>

Failed Example 6

This combobox uses aria-owns instead of using the required aria-controls property.

<label for="tag_combo">Tag</label>
<input type="text" id="tag_combo" role="combobox" aria-expanded="true" aria-owns="popup_listbox" />
<ul role="listbox" id="popup_listbox">
	<li role="option">Zebra</li>
	<li role="option" id="selected_option">Zoom</li>
</ul>

Inapplicable

Inapplicable Example 1

This div is not included in the accessibility tree due to its role of generic.

<div>Some Content</div>

Inapplicable Example 2

This combobox is not included in the accessibility tree due to its styling, hiding it from everybody.

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