ARIA commands must have an accessible name
Rule ID: aria-command-name
User Impact: serious
Guidelines: WCAG 2.0
The aria-command-name problem occurs when interactive elements (e.g., buttons, links, menus) are not assigned a valid ARIA role or when custom ARIA attributes are used incorrectly. This can lead to assistive technologies misinterpreting or ignoring these elements, reducing accessibility.
For example screen readers are not able to discern the purpose of elements with role="link", role="button" or role="menuitem" that do not have an accessible name.
Here is how you can fix issues related to aria-command-name
:
Ensure Proper Use of ARIA Roles
- Verify that interactive elements like buttons and links have appropriate ARIA roles.
Userole="button"
for a custom button orrole="link"
for a custom hyperlink. - Avoid unnecessary ARIA roles when native HTML semantics suffice. For example, use
>button>
instead of<div role="button">
.
Provide Accessible Names
Make sure every interactive element has an accessible name that clearly describes its purpose, by using the aria-label
or aria-labelledby
attributes.
Use ARIA Attributes Correctly
- Use only valid ARIA attributes appropriate to the assigned role.
- Avoid non-standard ARIA attributes like
aria-command-name
, as they might not be supported. - Consult the WAI-ARIA specification for the correct attributes for each role.
Other Rules
Interested in other web accessibility rules? Please see these other rules: