Aria Valid Attribute Value

Critical - WCAG Level A

The aria-valid-attr-value rule ensures that all ARIA attributes used in your HTML have valid values. Invalid values can lead to confusion for assistive technologies, which rely on these attributes to convey accurate information about the interface to users with disabilities. For example, if an aria-pressed attribute is set to a value other than 'true', 'false', or 'mixed', it becomes invalid and may not be interpreted correctly by screen readers.

For users relying on assistive technologies, such as screen readers, invalid ARIA values can result in incorrect or misleading information about the state or role of an element. This can lead to a frustrating experience, as users may not understand how to interact with the interface or may receive conflicting information. Ensuring valid ARIA values is crucial for maintaining the semantic structure of your web application and ensuring that all users can navigate and understand the content effectively.

How to fix it:

  1. Identify ARIA attributes: Review your HTML for any ARIA attributes you are using (e.g., aria-pressed, aria-expanded, etc.).

  2. Check values against specifications: Refer to the WAI-ARIA specification to verify that the values you are using are valid for each attribute.

  3. Update invalid values: Replace any invalid values with appropriate ones. For example, ensure that aria-pressed only uses 'true', 'false', or 'mixed'.

Best practices:

  • Use semantic HTML whenever possible, as it reduces the need for ARIA attributes and improves accessibility.

  • Regularly audit your code for ARIA attributes and their values, especially after updates or changes to the UI.

  • Document the purpose of ARIA attributes in your code comments to help future developers understand their usage.

Common mistakes:

  • Using ARIA attributes without understanding their valid values.

  • Setting ARIA attributes dynamically without validating the values.

  • Overusing ARIA when native HTML elements can provide the same functionality without additional attributes