On this page
ARIA & Accessibility Attributes
Prev: Form & Validation Attributes | Up: attributes | Next: tutorials
Rel: Progressive Enhancement & Accessibility, Document & Landmarks
Ref: MDN Web Docs — ARIA
Tags: #public #web #html #attributes #accessibility
Contents
First Rule of ARIA
Prefer native HTML semantics (<button>, <a href>, <dialog>, <nav>) over adding ARIA roles to generic <div>/<span> elements. ARIA changes how assistive technologies announce an element, not its keyboard behavior or styling.
Naming, Descriptions & State
aria-label: Provides an accessible name when no visible text exists (e.g., an icon-only close button).aria-labelledby="id1 id2": References visible heading/label elements as the accessible name.aria-describedby="hint-id": Connects supplementary help or error text to a form control.aria-expanded="true|false"+aria-controls="panel-id": Announces disclosure/menu open state.aria-hidden="true": Hides purely decorative icons from the accessibility tree (never place on focusable elements).
<button type="button" aria-expanded="false" aria-controls="menu-panel">
Menu
</button>
<div id="menu-panel" hidden>
<a href="settings.html">Settings</a>
</div>
Live Regions (aria-live)
Live regions announce dynamic DOM text updates to screen readers without moving keyboard focus:
aria-live="polite"(role="status"): Announces when the user is idle (e.g., "Saved successfully").aria-live="assertive"(role="alert"): Interrupts immediately for urgent errors.
Linked from
Related notes
- tuts/html/attributes Linked here; links to this page; shared tags: #attributes, #html, #web
- tuts/html/attributes/form_and_validation_attributes Linked here; links to this page; shared tags: #attributes, #html, #web
- tuts/web/tutorials/progressive_enhancement_and_accessibility Linked here; links to this page; shared tags: #accessibility, #web
- tuts/html/elements/document_and_landmarks Linked here; shared tags: #html, #web
- tuts/html/tutorials Linked here; shared tags: #html, #web
- tuts/html/attributes/global_attributes shared tags: #attributes, #html, #web
- tuts/html shared tags: #html, #web
- tuts/html/elements shared tags: #html, #web
- tuts/html/elements/forms shared tags: #html, #web
- tuts/html/elements/forms/button shared tags: #html, #web