` — it gets keyboard focus and click handling for free.
Use ARIA when you build custom components that have no HTML equivalent.
**aria-label** gives an element an accessible name — what the screen reader announces:
<!-- Icon button with no visible text -->
<button aria-label="Close dialog">
<svg>...</svg>
</button>
<!-- Two navs on the same page -->
<nav aria-label="Main navigation">...</nav>
<nav aria-label="Footer navigation">...</nav>
<!-- Search input -->
<input type="search" aria-label="Search lessons">
**aria-labelledby** points to another element's text as the label — better than aria-label because the label is visible:
<h2 id="modal-title">Confirm Delete</h2>
<div role="dialog" aria-labelledby="modal-title" aria-modal="true">
<p>Are you sure you want to delete this lesson?</p>
<button>Delete</button>
<button>Cancel</button>
</div>
**aria-hidden** removes an element from the accessibility tree — screen readers skip it entirely:
<!-- Decorative icon beside labelled text -->
<button>
<svg aria-hidden="true" focusable="false">...</svg>
Save changes
</button>
<!-- Visual sparkle effect -- screen readers don't need this -->
<div aria-hidden="true" class="confetti"></div>
**aria-expanded** announces whether a collapsible element is open or closed:
<button aria-expanded="false" aria-controls="menu">
Menu
</button>
<ul id="menu" hidden>
<li><a href="/">Home</a></li>
<li><a href="/learn">Learn</a></li>
</ul>
<!-- JavaScript toggles aria-expanded and hidden together -->
**aria-live** announces dynamic content changes — like search results or notifications:
<!-- polite: waits until user is idle to announce -->
<div aria-live="polite" aria-atomic="true" id="search-status">
<!-- JS updates this: "5 results found" -->
</div>
<!-- assertive: interrupts immediately (use sparingly) -->
<div role="alert" aria-live="assertive">
<!-- For critical errors only -->
</div>
Tip:
Frequently Asked Questions
When should I use aria-label vs aria-labelledby?
Prefer aria-labelledby when there is already visible text on the page that serves as the label — it references that text so there is no duplication. Use aria-label when there is no visible label text (icon-only buttons, for example).
Can I add ARIA to any element?
Technically yes, but some role+element combinations are invalid (like role=button on an input). Follow the ARIA in HTML spec which lists allowed role+element combinations.
Is ARIA required for every website?
No. A website built with correct semantic HTML (headings, landmarks, labels, buttons, links) is largely accessible without any ARIA. ARIA is needed for complex interactive components: carousels, modals, custom dropdowns, tabs, and live regions.