ARIA

Use roles that fit the HTML element

Rule ID: PF-ROLE-FITS-ELEMENT

  • Best practice

Why it matters

ARIA in HTML limits which roles each native element may take, because some overrides, such as turning a heading into a button, produce a control whose built-in behavior and announced role no longer agree. This is a best practice, not a WCAG requirement.

Who it affects

  • Screen reader and other assistive technology users

How to fix it

Use the native element that already has the role you need, or put the role on a wrapper or child element instead of overriding a restricted one, for example a <button> inside an <h2> rather than <h2 role="button">.

Accessible example
<h2>
  <button type="button" aria-expanded="false" aria-controls="faq-refunds">How do refunds work?</button>
</h2>
<div id="faq-refunds" hidden>Refunds reach your card within five working days.</div>

How to verify a fix

Scan the page again: the element should no longer be listed for this rule. Then check it the way people use it, for example with a keyboard or a screen reader, since a passing rule shows the markup is right, not that the experience works.

What automated testing can confirm

This is an automated rule that runs on every Pallyfi scan. A pass means the rule found no failing elements in what was rendered at scan time; it doesn’t cover content behind interactions the scan didn’t reach, and some criteria still need a person to check with a keyboard or screen reader. When the rule can’t decide on its own, the element is listed under Needs review instead. Manual audits record human evidence alongside the automated result.

Check your site for this

Quick Scan checks a public page against every rule Pallyfi runs and shows each failing element.

Run a Quick Scan