Skip to main content
HTML Validation

Element “a” is missing one or more of the following attributes: “aria-checked”, “aria-level”, “href”, “role”.

About This HTML Issue

An <a> element without an href attribute can't use aria-expanded unless it also has a role that supports that state.

Without href, an <a> isn't a link. HTML treats it as a placeholder, and its ARIA role is generic. The aria-expanded attribute only applies to certain roles, such as button, link, tab and menuitem, so on a placeholder anchor it describes a state that screen readers have nothing to attach to. The anchor also can't receive keyboard focus, so keyboard users can't reach the control.

This usually comes from a menu or dropdown toggle written as <a aria-expanded="false"> and wired up with JavaScript. The message also lists aria-checked and aria-level, but adding either of them doesn't fix the element: the validator then asks for href or role instead. Add an href if the element takes the user somewhere. If it opens and closes part of the page, replace it with a <button type="button">, which is focusable, works with the keyboard and supports aria-expanded without extra attributes. Keeping the <a> with role="button" and tabindex="0" also passes validation, but then your script has to handle the Enter and Space keys.

Invalid example

<a class="menu-toggle" aria-expanded="false" aria-controls="account-menu">Account</a>
<ul id="account-menu" hidden>
  <li><a href="/profile">Profile</a></li>
  <li><a href="/logout">Log out</a></li>
</ul>

Valid example

<button type="button" class="menu-toggle" aria-expanded="false" aria-controls="account-menu">Account</button>
<ul id="account-menu" hidden>
  <li><a href="/profile">Profile</a></li>
  <li><a href="/logout">Log out</a></li>
</ul>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries