aria-rolesElement has an invalid ARIA role
A role attribute with a value that isn’t a real ARIA role, such as role="btn" or role="drawer", or an abstract one like role="widget", is ignored. Use a valid role, or better, the native HTML element that already has it.
Who it hurts
Screen reader users and voice control users, who get no role, so a control isn’t announced as a button, dialog or menu.
Made-up roles often come from naming things after CSS classes. The element then behaves like a plain <div>.
How to fix it
Pick your stack. Review every change before you ship it.
Before
<div role="btn" tabindex="0">Add to bag</div>After
<button type="button">Add to bag</button>Check it by hand too
Tab to each custom control with a screen reader on. Each should be announced with its type, such as “button” or “dialog”.
Automated checks find a large share of accessibility problems, but not all of them. Passing this check does not on its own make a page compliant.
WCAG reference
- 4.1.2 Name, Role, Value (Level A). Understanding 4.1.2