| 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 |
|
||||||||||||||||||||||||||||
| input_aspects |
|
||||||||||||||||||||||||||||
| acknowledgments |
|
This rule applies to any HTML or SVG element that is included in the accessibility tree.
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.
- 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.
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.
- 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 explicitly set.
<div role="heading" aria-level="1">
My First Heading
</div>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>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>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>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>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>This checkbox has its required aria-checked property implicitly set.
<label>
<input type="checkbox" />
Check me
</label>This menuitemcheckbox has its required aria-checked property implicitly set.
<label>
<input type="checkbox" role="menuitemcheckbox" />
Check me
</label>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" />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>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>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>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 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>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>This div is not included in the accessibility tree due to its role of generic.
<div>Some Content</div>This combobox is not included in the accessibility tree due to its styling, hiding it from everybody.
<div role="combobox" style="display:none;"></div>