Skip to content
FunnelGuard

Fix guide by FunnelsGuard

ARIA roles misused: role=button on links and aria-hidden on focusable

PRF-325Medium impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

ARIA (Accessible Rich Internet Applications) is a set of attributes that describe elements to assistive technology such as screen readers. It changes what is announced. It does not change how an element behaves. Two mistakes are very common.

1. role="button" on a link. An <a href> announced as a button promises that Space will activate it. A link only responds to Enter, so the promise is broken. A link that goes to another page should be announced as a link.

2. aria-hidden="true" on a focusable element. aria-hidden removes an element from what screen readers can read. It does not remove it from the tab order. A keyboard user lands on a button or field that the screen reader says does not exist, so focus goes to silence.

Typical misusehtml
<!-- Link announced as a button -->
<a href="/book" role="button">Book a call</a>

<!-- Hidden from screen readers but still focusable -->
<div aria-hidden="true">
  <button>Start free trial</button>
  <a href="/pricing">Pricing</a>
</div>

Why it costs you leads or sales

People using screen readers, voice control or a keyboard meet your forms, booking buttons and checkouts through these roles. When the role is wrong, they do not know what a control does or cannot reach it. Some will leave. Others will not be able to finish at all.

A hidden but focusable button inside a slide-out menu or an old popup is a common trap. Focus lands there, nothing is announced, and the visitor loses their place on the page. Voice control users can also fail to say the name of a control if its role and label disagree.

There is also a legal and reputational side. These patterns fail WCAG 2.2 success criterion 4.1.2 (Name, Role, Value), and automated testers report them, so they show up in accessibility audits that buyers and procurement teams may run.

Where a keyboard and screen reader user gets stuck
  1. Landing pagePage loads and reads fine
  2. Tab to Book buttonInside aria-hidden container, so nothing is announced
  3. Booking formUser unsure what they activated
  4. Lead submittedNever reached

A hidden-but-focusable button breaks the path to the form.

How to check if your site has it

Find misused ARIA
  1. Run an automated accessibility scan

    Use a browser-based checker such as the axe DevTools extension, Lighthouse (Accessibility category in Chrome DevTools) or WAVE. Look for the rules named aria-hidden-focus and aria-allowed-role, and for roles flagged as not allowed on that element.

  2. Search your HTML for the patterns

    Open View Source or DevTools and search for role="button" next to an <a href> and for aria-hidden="true". For each aria-hidden match, check whether anything inside it can take focus (links, buttons, inputs, tabindex).

  3. Tab through the page

    Press Tab repeatedly with a mouse set aside. If focus disappears, or lands on something you cannot see, there is likely a hidden focusable element.

  4. Test a link with the Space key

    Focus any element with role="button" that is really a link and press Space. If the page scrolls instead of acting, it is a link dressed as a button.

  5. Listen with a screen reader

    Try NVDA or VoiceOver on your key journeys (forms, booking, checkout). Note anything announced with the wrong type or skipped.

How to fix it

The rule of thumb: use the native element that matches the behaviour. If it goes to a new URL, use a link. If it runs an action on the page (open a menu, submit, add to cart), use a button. Then make sure anything hidden is truly unreachable.

Fixed versionshtml
<!-- Navigates: keep it a link, drop the role -->
<a href="/book" class="btn">Book a call</a>

<!-- Acts on the page: use a button -->
<button type="button" class="btn" id="open-chat">Chat with us</button>

<!-- Hidden panel: inert removes it from tab order and screen readers -->
<div id="menu" hidden>
  <button>Start free trial</button>
</div>

<!-- Or keep it visible but unreachable while a modal is open -->
<main inert>...</main>
Fix by platform
  1. Find the source

    Run axe on the page and note the selector. Check whether the markup comes from your theme, a page builder or a plugin.

  2. Edit the element

    In Elementor, Divi or the block editor, open the button or link widget. Remove any custom role attribute from Advanced settings or the HTML anchor field. For link buttons, keep the link type.

  3. Fix theme templates

    For hard-coded markup, use a child theme and edit the template file in Appearance > Theme File Editor, or ask the theme author for a fix. Avoid editing a parent theme directly, as updates overwrite changes.

Link and hidden menu, before and after

Misused ARIA

  • <a role="button"> announced as button, Space does nothing
  • Closed menu uses aria-hidden but links still tabbable
  • Screen reader users land on silent controls

Native elements

  • Plain <a> announced as link, Enter works
  • Closed menu uses hidden or inert
  • Tab skips what is not available

How to confirm it's fixed

Confirmation checks
  • axe, Lighthouse or WAVE no longer reports aria-hidden-focus or role errors on the page
  • Tab moves only through visible, usable controls
  • Links activate with Enter; buttons activate with Enter and Space
  • A screen reader announces links as links and buttons as buttons
  • Opening and closing menus and modals leaves no focusable item in a hidden area
  • Key journeys (form, booking, checkout) work by keyboard alone

How to prevent it happening again

Add an accessibility linter or scanner to your workflow. For developers, the eslint-plugin-jsx-a11y package (for React code) or axe-core in your tests catches these patterns before release. For non-developers, run a scan after every theme update, new plugin or page builder change.

Agree a simple house rule: navigation uses links, actions use buttons, and nothing gets a role unless a native element cannot do the job. Review third-party widgets (chat, cookie banners, popups) too, since they often add their own markup.

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard runs your real customer journeys on a schedule and checks that steps complete, tracking hits are sent and test leads arrive. It does not audit your markup for ARIA roles or hidden focusable elements.

The kind of tool that fits is an accessibility testing tool: an automated scanner such as axe, Lighthouse or WAVE for quick checks, plus manual keyboard and screen reader testing for the rest. Use it alongside monitoring: an accessibility scanner tells you if your markup is wrong, and FunnelGuard tells you if the journey itself still works.

Questions people ask

Why does my accessibility checker say aria-hidden elements should not be focusable?

aria-hidden="true" hides an element from screen readers but leaves it in the tab order. A keyboard user can land on it and hear nothing. Remove aria-hidden, or hide the content with the hidden attribute, inert or display:none so it is unreachable as well.

Is it wrong to use role="button" on a link?

Usually yes. A link that goes to a page should be announced as a link. role="button" tells users Space will work, but links only respond to Enter. Use a real <button> for on-page actions and a plain <a> for navigation.

How do I fix aria-hidden on a focusable element?

Decide whether the content should be available. If not, hide it with the hidden attribute, inert or display:none. If it should be available, remove aria-hidden. Then tab through the page to check that focus never lands on something that is not announced.

Should I add tabindex=-1 to elements that have aria-hidden?

It is not the best fix. tabindex="-1" removes an element from the tab order but it can still be focused by script or click. The inert attribute or display:none is more reliable because it removes both focus and screen reader access.

What is the inert attribute and when should I use it?

inert is an HTML attribute that makes an element and everything inside it non-interactive and hidden from assistive technology. Use it on page content behind an open modal, or on off-screen panels. Add it when the area is unavailable and remove it when it is available.

Can I use ARIA instead of proper HTML elements?

Avoid it where you can. The first rule of ARIA is to use a native element if one exists. A native <button> or <a> already brings keyboard support, focus and the correct role, while ARIA only adds a label and does not add behaviour.

Which tools find misused ARIA roles?

Axe DevTools, Lighthouse and WAVE all report ARIA errors on a page. They catch many cases but not all, so test with a keyboard and a screen reader such as NVDA or VoiceOver as well.

Does FunnelGuard check for ARIA misuse?

No. FunnelGuard checks that journeys complete, tracking fires and test leads arrive. ARIA roles need an accessibility scanner such as axe, Lighthouse or WAVE, plus manual testing.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.