Fix guides · Accessibility

How to fix invalid ARIA (roles, attributes and duplicate IDs)

Misspelled ARIA attributes, roles used on the wrong elements, and labels pointing at duplicate IDs make screen readers report the page incorrectly. How to find and fix them.

Time to fix
20–60 minutes
Skill needed
Developer
Who notices
Screen reader users

Why it matters

ARIA attributes describe what an element is and what state it's in. When they're misspelled (aria-lable), given impossible values (aria-expanded="yes"), missing a required partner (a checkbox role without aria-checked) or put on elements that don't support them, assistive technology either ignores them or reports something wrong.

IDs referenced by labels and ARIA must be unique. If two elements share an id, only the first one is used, so a label can end up describing the wrong field.

“Using an invalid role-attribute combination will, at best, result in no effect on the accessibility of the application and, at worst, may trigger behavior that disables accessibility for entire portions of an application.”

Deque axe rule: aria-allowed-attr (used by Lighthouse)

Before you start

  • Your report names the rule and the element. The fix is usually one attribute: correct its spelling or value, add the attribute the role requires, or remove one that isn't allowed.
  • The first rule of ARIA: if a native HTML element does the job (<button>, <nav>, <input type="checkbox">), use it instead of a role.
  • Duplicate IDs often come from a component repeated on the page (a product card or form used twice). Generate unique IDs per instance.

Fix it on your platform

Shopify

  1. Shopify's theme accessibility guidance says navigation shouldn't use role="menu" or role="menuitem", and that dropdowns use aria-expanded and aria-controls.
  2. If the element is in your theme, fix it in Edit code or ask your theme developer. If it belongs to an app, contact the app's developer.

WordPress

  1. Find which theme part or plugin outputs the element (menus, sliders and page builders are common). Update it, or ask its developer; avoid editing plugin files directly, as updates overwrite them.

Webflow

  1. Check custom attributes you've added (Element settings → Custom attributes) for misspelled names or invalid values.
  2. For duplicate IDs, open the Audit panel: it lists elements and component instances that share an ID, with a link to each one's settings.

Wix Managed by the platform

  1. Wix defines ARIA attributes for the elements it provides. If an app or your custom code is listed, fix or remove that code.

Squarespace Managed by the platform

  1. Squarespace generates the code for its own elements. If code injection or an extension is listed, fix or remove that code; otherwise contact Squarespace support.

Next.js

  1. Use React's useId() for IDs inside reusable components, so each instance gets a unique one.
  2. eslint-plugin-jsx-a11y (included in Next.js's ESLint config) catches many invalid ARIA attributes and roles as you type.
Unique IDs
const id = useId();

return (
  <>
    <label htmlFor={id}>Quantity</label>
    <input id={id} type="number" />
  </>
);

Any other site

  1. Check each flagged attribute against the WAI-ARIA specification, and make every id on the page unique.
Before and after
<!-- Before: misspelled, invalid value -->
<button aria-lable="Menu" aria-expanded="yes">

<!-- After -->
<button aria-label="Menu" aria-expanded="false">

Check that it's fixed

  • Re-run your StudioLNC audit: the elements should no longer be listed.
  • Test the affected menus and widgets with a screen reader.

Find every issue like this on your site

Free audit of performance, accessibility, SEO and security, with fixes for your platform.