Uses ARIA roles on incompatible elements
How to fix the aria-allowed-role accessibility rule. ARIA. A best practice, not a WCAG requirement.
The message you saw
Lighthouse runs axe-core inside it, so both are the same check, and the fix below works whichever tool showed you the message.
What it means
HTML elements come with their own meaning, and the HTML standard lists which ARIA roles each element may take instead. This message means an element has a role that isn’t on its list, for example a heading turned into a button, a text field turned into a button, or an image that has alt text but is marked as decorative.
The role overrides what the element is, but not how it behaves. The browser still treats an <h2 role="button"> as a heading for some purposes and a button for others, and the result differs between browsers and screen readers.
Who is affected
The role conflicts with the HTML element it's on (for example a heading made into a button), so the element's real meaning is lost or behaves inconsistently.
Screen-reader users can lose the element’s real meaning (a heading that disappears from the list of headings) or get a role whose keyboard behaviour isn’t there. It is a best practice, not a WCAG failure by itself, but it often comes with real problems.
How to find it
- Run the checker with “Also show best-practice suggestions” ticked: the report shows the element and the role that doesn’t fit.
- Search your code for
role=on headings,<input>s,<img>s with alt text, and<li>s.
How to fix it
- Use the element that matches what the thing does. A control that does something is a
<button>; a heading that opens a section can contain a button:<h2><button aria-expanded="false">…</button></h2>. - If the role was added for styling or by habit, remove it.
- For images:
role="presentation"with real alt text contradicts itself. If the image is decorative usealt=""; if it carries meaning, keep the alt and drop the role.
Examples
A heading that opens a section (accordion)
Before
<h2 role="button" tabindex="0">Delivery</h2>After
<h2><button type="button" aria-expanded="false">Delivery</button></h2>An image marked decorative but with alt text
Before
<img src="team.jpg" alt="Our support team" role="presentation">After
<img src="team.jpg" alt="Our support team">Common mistakes
- Repeating an element’s own role (
<ul role="list">,<nav role="navigation">) is allowed.role="list"on a<ul>is even a known fix for Safari dropping list semantics when bullets are removed with CSS. - Some overrides are allowed, such as
role="button"on a link orrole="menuitem"on a list item. Allowed doesn’t mean it is a good idea; a real<button>is still simpler.
WCAG success criteria
None. This is a best practice: fixing it helps people using assistive technology, but it doesn’t affect WCAG conformance. Our scanner only reports it if you tick “Also show best-practice suggestions”.
Check your fix
Scan a web page and the report lists every element that fails this rule, with screenshots outlining where they are, the code, and a selector you can paste into your browser’s developer tools. Scan again after your change: when the rule no longer appears under the problems, the fix worked.
An automated pass means this rule found nothing wrong. It doesn’t prove the page is accessible: some of what WCAG asks for needs a person to check, and the report’s manual checklist lists those steps.
Related fix guides
[role]values are not valid- Certain ARIA roles must contain particular children
- Buttons do not have an accessible name
- Image elements do not have
[alt]attributes
More detail
- Deque University’s reference for aria-allowed-role (the makers of axe-core, the engine our scanner uses)
- All fix guides