Ensure All ARIA Attributes Have Valid Values

Photo of Researcher
Yotam Flohr
Researcher
Blind Low vision Mobility
WCAG 2.1 Level A

Written and researched for humans by humans

Photo of Researcher
Yotam Flohr
Researcher
Photo of Expert
Ritvik Shrivastava
Expertly reviewed by
Comments: 0
Your entire domain
Get detailed instructions on how to resolve every accessibility issue on your website

Web accessibility requirements state that ARIA attributes starting with aria- must contain valid values. These values must be spelled correctly and correspond to values that make sense for a particular attribute in order for the necessary accessibility function to be performed. 

Why It Matters

ARIA attributes that have invalid values can create accessibility issues for multiple users. 

Fixing the Issue

Ensure the value inside each attribute is spelled correctly and corresponds to a valid value.

For example, aria-hidden=”true” would pass, but aria-hidden=”rtue” would fail, as would aria-hidden=”pizza”.

As another example, the checkbox role only has three possible values: true, false, or mixed. Using any value other than one of those three will prevent the checkbox from functioning as intended

Value Types

It’s helpful to keep the following allowed state or property value types in mind:

  • true/false – Value representing either true or false, with a default “false” value.
  • tristate – Value representing true or false, with an intermediate “mixed” value. Default value is “false” unless otherwise specified.
  • true/false/undefined – Value representing true or false, with a default “undefined” value indicating the state or property is not relevant.
  • ID reference – Reference to the ID of another element in the same document
  • ID reference list – A list of one or more ID references.
  • integer – A numerical value without a fractional component.
  • number – Any real numerical value.
  • string – Unconstrained value type.
  • token – One of a limited set of allowed values.
  • token list – A list of one or more tokens.

Undefined Value: The “undefined” value, when allowed on a state or property, is an explicit indication that the state or property is not set. The value is used on states and properties that support tokens, and the “undefined” value is a string that is one of the allowed tokens. It is also used on some states and properties that accept true/false values, when “undefined” has a different meaning than “false”.

These are generic types for states and properties, but do not define specific representation. See State and Property Attribute Processing for details on how these values are expressed and handled in host languages.

Default Value and Implicit Value for Role: Many states and properties have default values. Occasionally, the default value when used on a given role should be different from the usual default. Roles that require a state or property to have a non-standard default value indicate this in the “Implicit Value for Role”. This is expressed in the form “state or property name is new default value”. Roles that define this have the new default value for the state or property if the author does not provide an explicit value.

State and Property Values Reference: For complete information about allowed values, refer to the table of characteristics for each individual attribute at W3C WAI-ARIA 1.1 Supported States and Properties.

Test Cases

For more examples, visit W3C’s GitHub’s ATC Rules library