NeovaPiattaforma SEO avanzata

Attributo ARIA non consentito per il ruolo dell'elemento

In Neova Funziona con la scansione stessa: niente da configurare.

Regola rivista il 17 ottobre 2026 · Guida aggiornata il 21 settembre 2026

Il criterio WCAG 4.1.2 richiede stati e proprietà validi. Gli screen reader ignorano o interpretano male un attributo che il ruolo non supporta, quindi lo stato potrebbe non arrivare a chi li usa.

Cosa potresti fare

Rimuovi l'attributo, oppure cambia il ruolo con uno che lo supporti.

Perché Neova lo segnala

  • Ogni ruolo ARIA supporta solo certi attributi; gli altri vengono ignorati o letti male dagli screen reader.
  • Uno stato come expanded o selected messo sul ruolo sbagliato non arriva mai all'utente.
  • Il criterio WCAG 4.1.2 (livello A) richiede che stati e proprietà siano esposti correttamente.

Fonti

La guida completa

Per ora questa parte è in inglese.

TL;DR: This issue fires when an element carries an aria-* attribute that is not permitted for its role. The fix is to remove the attribute that does not belong, switch to a role that actually supports it, or drop the ARIA entirely and use a native HTML element that already has the right semantics. It maps to WCAG 4.1.2 Name, Role, Value.

What This Means

Every ARIA role has a defined set of states and properties it is allowed to use. The WAI-ARIA specification sorts these into required attributes, supported attributes, and attributes inherited from parent roles. When you place an aria-* attribute on an element whose role does not list that attribute, the pairing is invalid. The axe rule name is aria-allowed-attr, and the plain-language version is "Elements must only use allowed ARIA attributes."

A common example: aria-checked is only valid on roles such as checkbox, radio, menuitemcheckbox, and menuitemradio. Put it on a plain link or a generic div with no matching role and it is not allowed there.

Why It Matters

When assistive technology meets a role-attribute mismatch, it has no reliable way to interpret the extra attribute. It may ignore the attribute, or it may announce or behave in an unexpected way. At best the disallowed attribute does nothing; at worst it blocks access to a whole region of the interface. Screen reader users can end up with a control that is mislabeled, mis-stated, or simply unusable.

This is a Name, Role, Value problem under WCAG 2.1 Success Criterion 4.1.2 (Level A). The criterion requires that the name, role, states, and properties of every user-interface component can be programmatically determined. A disallowed ARIA attribute breaks that contract because the role and the property contradict each other. Clean ARIA also keeps your markup machine-readable for the growing set of automated and AI agents that parse the page, not just traditional screen readers.

Which Attributes Belong to Which Roles

The whole rule comes down to matching a property to a role that actually lists it. This is not the full ARIA table, but it covers the mismatches that get flagged most often. Read it as: this attribute is only allowed where the right-hand column applies.

Attribute Allowed on Roles Like Flagged When Put On
aria-checked checkbox, radio, menuitemcheckbox, switch a link, a plain div, a button
aria-selected option, tab, row, gridcell a listitem, a generic span
aria-valuenow slider, progressbar, spinbutton, scrollbar a button, a checkbox
aria-posinset option, listitem, menuitem, tab a heading, a paragraph
aria-label, aria-hidden almost everything (global) rarely flagged; check the role first

How to Detect It

Three tools will find every instance without you reading markup by hand. Run at least one on any page with custom widgets.

  1. axe DevTools (browser extension). Open your browser dev tools, pick the axe tab, and run a scan. The violation appears as aria-allowed-attr with "Elements must only use allowed ARIA attributes"; each result highlights the element, its role, and the offending attribute. Newer builds phrase it as "supported ARIA attributes."
  2. Google Lighthouse. In Chrome dev tools, open the Lighthouse tab, tick Accessibility, and generate a report. The same failure shows under Accessibility as "[aria-*] attributes are not allowed for this element's role," with a list of failing nodes.
  3. ARIA DevTools (browser extension). This one renders the page the way a screen reader sees it, so you can spot the contradictory role-attribute pairing in context and confirm which attribute the role actually supports before you touch code.

WAVE, Accessibility Insights, and Neova's accessibility module flag the same condition, so any of them can confirm a fix once you have made it.

How to Fix It

1. Identify the Element's Role

Check for an explicit role attribute. If there is none, the element uses the implicit role of its tag. For instance, <input type="checkbox"> has the implicit role checkbox, and <nav> has the role navigation.

2. Remove Attributes Not Valid for the Role

Look up the role in the WAI-ARIA specification and check its required, supported, and inherited attributes. Delete any aria-* attribute that is not on that list.

<!-- Bad: aria-checked is not allowed on a link -->
<a href="https://example.com/filter" aria-checked="true">Show in stock</a>

<!-- Good: drop the disallowed attribute -->
<a href="https://example.com/filter">Show in stock</a>

3. Use a Role That Supports the Attribute

If the attribute really is needed, the element is probably the wrong role. Give it a role that lists that attribute as required or supported.

<!-- Good: aria-checked is valid on role="checkbox" -->
<span role="checkbox" tabindex="0" aria-checked="true">
  Show in stock
</span>

4. Prefer Native HTML

The first rule of ARIA is to use a native element when one provides the semantics and keyboard behavior you need. Native controls carry the correct role and state support for free, so the mismatch cannot happen.

<!-- Best: native checkbox, no ARIA needed -->
<label>
  <input type="checkbox" checked> Show in stock
</label>

False Positives

Genuine false positives are rare, but a few cases are worth checking before you change code. Global ARIA attributes such as aria-label, aria-hidden, and aria-describedby are allowed almost everywhere; if one is flagged, the element more likely has an unusual or contradictory role that narrows what is permitted. If a framework or component library injects the attribute at runtime, confirm what is actually in the rendered DOM rather than the source template. And if an attribute is added by script only when a matching role is also present, test the live state rather than the initial markup.

Want a full sweep of your site's ARIA and accessibility issues, prioritized and explained?

FAQ

Is This the Same as the "Prohibited ARIA Attributes" Issue?

No, but they are close cousins. "Allowed" (aria-allowed-attr) checks that an attribute is valid for the element's role. "Prohibited" (aria-prohibited-attr) flags attributes such as aria-label on elements that should not be named at all. Both come down to matching attributes to the correct role.

Will an Invalid Attribute Always Break the Page?

Not always, and that is the risk. Many assistive technologies simply ignore the disallowed attribute, so the page may seem fine in casual testing. But behavior is undefined, so some tools will mis-announce or mishandle the control. Fix it rather than relying on it being ignored.

How Do I Know Which Attributes a Role Allows?

Each role in the WAI-ARIA specification lists its required, supported, and inherited states and properties. Look up the role, compare that list to the attributes on your element, and remove anything that is not present.

Should I Add a Role to Keep the Attribute, or Remove the Attribute?

Ask what the element is meant to do. If it genuinely behaves like a checkbox or tab, give it the matching role (and the keyboard support that role implies). If the attribute was a leftover or copy-paste error, just remove it. When in doubt, reach for a native HTML element instead.

Trovalo sul tuo sito

Neova esegue questo controllo e tutti gli altri a ogni scansione, poi scrive la correzione come ticket per il tuo team.

  • App desktop per Mac, Windows e Linux
  • Tutti i 696 controlli, ognuno con la sua fonte
  • Search Console e Analytics 4, collegati in sola lettura
  • Ticket verso Jira, Linear e Asana

Scarica Neova Piano Desktop Free, oppure Solo gratis per 14 giorni, senza carta.

Tutti i controlli della categoria Accessibilità · Guide · Libreria dei controlli

Scritto da Neova Labs · Torna alla Libreria dei controlli