| id | 4e8ab6 | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | Element with role attribute has required states and properties | ||||||||||||||||||||||||||||||
| rules_format | 1.1 | ||||||||||||||||||||||||||||||
| rule_type | atomic | ||||||||||||||||||||||||||||||
| description | This rule checks that elements that have an explicit role also specify all required states and properties. | ||||||||||||||||||||||||||||||
| accessibility_requirements |
|
||||||||||||||||||||||||||||||
| input_aspects |
|
||||||||||||||||||||||||||||||
| acknowledgments |
|
This rule applies to any HTML or SVG element that is included in the accessibility tree and has an explicit semantic role, except if the element has an implicit semantic role that is identical to the explicit semantic role.
For each test target, the WAI-ARIA required states and properties for the role are set and not empty (""), unless the state or property has a default value listed under WAI-ARIA implicit value for role.
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.
This rule is testing author built components that specify explicit semantic roles and not components that keep their implicit semantic role. For components that keep their implicit semantic role, all native HTML and SVG elements have native attributes that are mapped to all of the WAI-ARIA required states and properties. Most of these mappings are defined in the HTML Accessibility API Mappings, Attribute State and Property Mappings.
- The ARIA
roleis being used to conform to WCAG.
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.
- ARIA5: Using WAI-ARIA state and property attributes to expose the state of a user interface component
- WAI-ARIA required states and properties
- RFC 3986
This heading has the required aria-level property.
<div role="heading" aria-level="1">
My First Heading
</div>This checkbox has the required aria-checked property.
<div role="checkbox" aria-checked="false" aria-labelledby="label"></div>
<div id="label">Check me</div>This scrollbar has the required properties aria-controls and aria-valuenow. aria-valuemin has a default value of 0 and aria-valuemax of 100.
<div role="scrollbar" aria-controls="content" aria-valuenow="0"></div>
<main id="content"></main>These option nodes do not need the required aria-selected property because it has a default value of false.
<div id="label">Tags</div>
<ul role="listbox" aria-labelledby="label">
<li role="option">Zebra</li>
<li role="option">Zoom</li>
</ul>This separator is not a widget because it is not focusable. The separator role only requires the aria-valuenow property when the element is focusable.
<p>My first HTML</p>
<div role="separator"></div>
<p>My last HTML</p>This combobox has the required properties aria-controls and aria-expanded.
<label for="tag_combo" id="tag_label">Tag</label>
<input type="text" id="tag_combo" role="combobox" aria-expanded="true" aria-controls="popup_listbox" />
<ul role="listbox" id="popup_listbox" aria-labelledby="tag_label">
<li role="option">Zebra</li>
<li role="option" id="selected_option">Zoom</li>
</ul>This heading does not have the required aria-level property. Prior to WAI-ARIA 1.2 the heading role had an implicit 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>This switch does not have the required aria-checked property. Prior to WAI-ARIA 1.2 the switch role had an implicit default aria-checked value of false. As of WAI-ARIA 1.2 this property must be explicitly set.
<div role="switch">
Toggle me
</div>This checkbox does not have the required property aria-checked. Prior to WAI-ARIA 1.2 the checkbox had an implicit 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>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>This combobox does not have the required aria-expanded property. Prior to WAI-ARIA 1.2 the combobox had an implicit 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>This div does not have a semantic role.
<div>Some Content</div>This checkbox has an implicit semantic role that is identical to the explicit semantic role. This allows native HTML checked attribute to apply.
<input type="checkbox" role="checkbox" aria-label="Checkbox name" />This combobox is not included in the accessibility tree due to its styling, hiding it from everybody.
<div role="combobox" style="display:none;"></div>