Recommended practice Priority: Minor
An element has a role that does not fit it
An HTML element has a role attribute that is not allowed for that element, for example a <button> marked as a heading or a <nav> menu marked as a button. This is a recommended practice, not a WCAG AA requirement on its own, but it often points to other problems.
This text was translated automatically and has not been reviewed by a native speaker yet.
Why it matters to your customers
Screen readers may announce the element as something it is not, or announce it differently in each browser, so shoppers expect it to behave in a way it does not. It is usually a small confusion rather than a blocker.
Who is affected
- screen reader users
- voice control users
How to fix it
Use the native HTML element that matches the purpose (<button> for actions, <a href> for navigation, <h2> for headings) and remove the conflicting role. If a custom role is really needed, put it on a neutral element such as <div> or <span> and add the keyboard behaviour that role expects. The allowed roles per element are listed in the W3C "ARIA in HTML" specification.
On Shopify
Usually from custom sections, snippets or apps (menus, sliders, pop-ups). Fix the markup in the relevant Liquid section or snippet, or report it to the app developer.
On Shoptet (CZ)
Usually from the template or custom code. Fix your own custom code; if the template causes it, report it to Shoptet or a partner.
On PrestaShop
Usually from theme .tpl templates or third-party modules (menus, sliders). Correct the markup in the theme or module templates, preferably via an override.
On WooCommerce
Usually from page-builder widgets, menu or slider plugins, or custom theme templates. Fix it in a child theme template or report it to the plugin author.
Fix it with AI
Copy this prompt into ChatGPT, Claude or Copilot and add the HTML of the element. Check the answer before you publish it.
You are an experienced web developer and accessibility specialist. Fix this accessibility problem on my website so that it meets WCAG 2.2 level AA. Website: [https://…] ## Problem: An element has a role that does not fit it An HTML element has a role attribute that is not allowed for that element, for example a <button> marked as a heading or a <nav> menu marked as a button. This is a recommended practice, not a WCAG AA requirement on its own, but it often points to other problems. **How to fix:** Use the native HTML element that matches the purpose (<button> for actions, <a href> for navigation, <h2> for headings) and remove the conflicting role. If a custom role is really needed, put it on a neutral element such as <div> or <span> and add the keyboard behaviour that role expects. The allowed roles per element are listed in the W3C "ARIA in HTML" specification. ## Elements found by the automated check [Paste the HTML of the element here, or the selector from the Pandus report] ## Requirements - Change only what is needed; keep the design and how the site works. - Do not add accessibility overlays or widgets; fix the code or the content. - Show the corrected code and say in which template or file it goes. - Explain how to check the fix with the keyboard and a screen reader.
Standards
Not a WCAG success criterion: a recommended practice that makes the site easier to use.
Automated check: axe-core rule aria-allowed-role.
dequeuniversity.com, github.com, www.w3.org
Read next
Guides and tools
Help articles
-
How to read a report and what to fix first
What each part of the report means and how to turn it into a to-do list for your developer.