Ensure ARIA attributes have valid values

ARIA roles and attributes help screen readers provide missing information about an element. For these roles and attributes to make sense, each ARIA role supports a specific subset of aria-* attributes (see ARIA roles definitions). Assistive technologies, like screen readers, can't interpret ARIA attributes with invalid values. Lighthouse reports when attributes do not have valid values:

Lighthouse audit showing aria-checked without the value 'true'
Fig. 1 β€” ARIA attributes do not have valid values

Key Term: ARIA attributes let you modify the way HTML elements are represented to assitive technologies like screen readers. Learn more in this Introduction to ARIA.

How Lighthouse determines an attribute's value is invalid

Lighthouse uses the WAI ARIA specification - Definition of roles to check the values of roles and their attrbutes. Lighthouse fails this audit, when it finds attributes with invalid values. In the example Lighthouse audit above, aria-checked should be set to either "true", "false", or "mixed".

HTML boolean attributes such as hidden or checked are assumed to be either true or false depending on if they are present on the element.

However, ARIA attributes require an explicit "true" or "false" string. This is because most ARIA attributes actually support a third stateβ€”undefinedβ€”or a tristate with an intermediate "mixed" value.

How this audit impacts overall Lighthouse score

Lighthouse flags this as a low severity issue. It is important to fix, and probably indicates a mistaken assumption in your code. In the example above, the element is still announced as a checkbox but it will have an implicit checked state of "unchecked.

How to check for invalid attribute values

To check for invalid attribute values, refer to the WAI ARIA Definition of roles. ARIA defines a role's allowable attributes, and the valid values for those attributes. Check that you are using the correct values for any attributes you use in your roles.

For more information on this audit, see ARIA attributes must conform to valid values.

More information

Last updated: Improve article