Skip to content

Proposed ARIA state or property has valid value

Description

This rule checks that each ARIA state or property has a valid value type.

Applicability

This rule applies to any WAI-ARIA 1.2 state or property that is not empty (“”), and that is specified on an HTML or SVG element.

Expectation

Each test target has a valid value according to its WAI-ARIA 1.2 value type.

For value types ID Reference and ID Reference List for WAI-ARIA required properties at least one of the elements with the given ids exists in the same document tree or in the same shadow tree as the element that specifies the target attribute.

For value type URI the value matches the generic URI syntax.

Assumptions

This rule catches values that are undefined in WAI-ARIA Specifications, and where the resulting behavior in user agents are also undefined in WAI-ARIA. This might lead to accessibility issues, if the intention was to use behavior defined in WAI-ARIA Specifications. When values are used that do not have a defined behavior in WAI-ARIA Specifications, the HTML/SVG specification decides what default values should be used, since it is defined here what should happen when an invalid value is used for an attribute. If the default value for invalid attribute values happens to match the author’s intention for the value, there will not be an accessibility issue.

Accessibility Support

Some user agents treat the value of aria-* attribute as case-sensitive (even when these are not ID) while some treat them as case-insensitive.

Background

Using invalid ARIA attribute values is often the result of a typo or other developer error. These attributes are then either ignored, or a default value is assumed by browsers and assistive technologies. This often means that a state or property which should exist is missing or has an unexpected value. This can cause issues under success criterion 1.3.1 Info and Relationships or 4.1.2 Name, Rule Value.

Only for WAI-ARIA required properties with value types ID Reference and ID Reference List is there a requirement that the elements with the given ids actually exists. For non-required properties, this is not a requirement. For example, the value of the aria-errormessage attribute on an input does not need to reference an id that exists within the same document, because an HTML element with such and id may be created in response to an event that may or may not happen.

For value type URI, this rule does not require that the destination URI exists.

Bibliography

Accessibility Requirements Mapping

Input Aspects

The following aspects are required in using this rule.

Test Cases

Passed

Passed Example 1

Open in a new tab

aria-required property with valid true/false value

<div role="textbox" aria-required="true" aria-label="A required textbox"></div>

Passed Example 2

Open in a new tab

aria-expanded state with valid true/false/undefined value

<div role="button" aria-expanded="undefined">A button</div>

Passed Example 3

Open in a new tab

aria-pressed state with valid tristate value

<div role="button" aria-pressed="mixed">An other button</div>

Passed Example 4

Open in a new tab

aria-errormessage property with valid ID reference value

<div role="textbox" aria-errormessage="my-error" aria-label="A textbox"></div>

Passed Example 5

Open in a new tab

aria-owns property with valid ID reference list value

<h1>Shopping list</h1>
<div role="list" aria-owns="item1 item2"></div>
<div id="item1">Apples</div>
<div id="item2">Bananas</div>

Passed Example 6

Open in a new tab

aria-rowindex property with valid integer value

<div role="gridcell" aria-rowindex="2">Fred</div>

Passed Example 7

Open in a new tab

aria-valuemin, aria-valuemax and aria-valuenow properties with valid number values

<div role="spinbutton" aria-valuemin="1.0" aria-valuemax="2.0" aria-valuenow="1.5" aria-label="Select a value"></div>

Passed Example 8

Open in a new tab

aria-placeholder property with valid string value

<div role="textbox" aria-placeholder="MM-DD-YYYY" aria-label="Your birthdate">
	MM-DD-YYYY
</div>

Passed Example 9

Open in a new tab

aria-relevant property with valid token list values

<div role="alert" aria-relevant="text removals"></div>

Passed Example 10

Open in a new tab

aria-controls, which is a required property for the role scrollbar, has ID Reference list that references at least one element existing in the same document tree.

<div id="content1">Lorem ipsum...</div>
<div
	role="scrollbar"
	aria-controls="content1 content2"
	aria-orientation="vertical"
	aria-valuemax="100"
	aria-valuemin="0"
	aria-valuenow="25"
></div>

Failed

Failed Example 1

Open in a new tab

aria-required property with invalid true/false value

<div role="textbox" aria-required="undefined" aria-label="A required textbox"></div>

Failed Example 2

Open in a new tab

aria-expanded state with invalid true/false/undefined value

<div role="button" aria-expanded="mixed">A button</div>

Failed Example 3

Open in a new tab

aria-pressed state with invalid tristate value

<div role="button" aria-pressed="horizontal">An other button</div>

Failed Example 4

Open in a new tab

aria-errormessage property with invalid ID reference value, since space is not allowed in a single ID

<div role="textbox" aria-errormessage="error1 error2" aria-label="A textbox with an error"></div>

Failed Example 5

Open in a new tab

aria-rowindex property with invalid integer value

<div role="gridcell" aria-rowindex="2.5">Fred</div>

Failed Example 6

Open in a new tab

aria-valuemin, aria-valuemax and aria-valuenow property with invalid number values

<div role="spinbutton" aria-valuemin="one" aria-valuemax="three" aria-valuenow="two" aria-label="Choose a value"></div>

Failed Example 7

Open in a new tab

aria-live property with invalid token value

<div role="main" aria-live="nope"></div>

Failed Example 8

Open in a new tab

Element with invalid token list value

<div role="alert" aria-relevant="always"></div>

Failed Example 9

Open in a new tab

aria-expanded state with invalid true/false/undefined value for custom element

<my-button role="button" aria-expanded="collapsed">My button</my-button>

Failed Example 10

Open in a new tab

aria-controls, which is a required property for the role scrollbar, references an element that does not exist in the same document tree.

<div
	role="scrollbar"
	aria-controls="content1"
	aria-orientation="vertical"
	aria-valuemax="100"
	aria-valuemin="0"
	aria-valuenow="25"
></div>

Inapplicable

Inapplicable Example 1

Open in a new tab

Element does not have any ARIA states or properties

<div>Some Content</div>

Inapplicable Example 2

Open in a new tab

Element has ARIA role, but no ARIA states or properties

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

Inapplicable Example 3

Open in a new tab

aria-checked state with empty value

Note: The HTML validator flags an aria-checked attribute with an empty value as an issue. However, since WAI-ARIA 1.1, aria-checked has a default value of undefined.

<div role="checkbox" aria-checked>Accept terms and conditions</div>

Inapplicable Example 4

Open in a new tab

aria-hidden state on an element that is not an HTML or SVG element.

<math aria-hidden="true"></math>

Glossary

Namespaced Element

An element with a specific namespaceURI value from HTML namespaces. For example an “SVG element” is any element with the “SVG namespace”, which is http://www.w3.org/2000/svg.

Namespaced elements are not limited to elements described in a specification. They also include custom elements. Elements such as a and title have a different namespace depending on where they are used. For example a title in an HTML page usually has the HTML namespace. When used in an svg element, a title element has the SVG namespace instead.

Outcome

An outcome is 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:

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

WAI-ARIA specifications

The WAI ARIA Specifications group both the WAI ARIA W3C Recommendation and ARIA modules, namely:

Note: depending on the type of content being evaluated, part of the specifications might be irrelevant and should be ignored.

Rule Versions

This is the first version of this ACT rule.

Implementations

This section is not part of the official rule. It is populated dynamically and not accounted for in the change history or the last modified date.

Implementation Type Consistency Report
Alfa (fully automated) 0.57.2 Automated tool Consistent Alfa (fully automated) Report
Alfa (semi-automated) 0.57.2 Semi-automated tool Consistent Alfa (semi-automated) Report
Axe DevTools Pro 4.37.1 Semi-automated tool Partial Axe DevTools Pro Report
Axe-core 4.6.0 Automated tool Partial Axe-core Report
Equal Access Accessibility Checker 3.1.42-rc.0 Automated tool Partial Equal Access Accessibility Checker Report
QualWeb 3.0.0 Automated tool Consistent QualWeb Report
SortSite 6.45 Automated tool Consistent SortSite Report
Total Validator 17.1.0 Linter Partial Total Validator Report
Total Validator (+Browser) 17.1.0 Automated tool Partial Total Validator (+Browser) Report
Back to Top

This is an unpublished draft preview that might include content that is not yet approved. The published website is at w3.org/WAI/.