ARIA12 min25 XP

Accessibility ARIA

Learn Accessibility ARIA with syntax-highlighted examples, live output, and Shiv AI.

Accessibility and ARIA

Over 1 billion people worldwide have a disability. Web accessibility means making websites usable by everyone — blind users with screen readers, people with motor disabilities using keyboards only, and more.

Semantic HTML is the Foundation

Example — Semantic vs Non-Semantic
<!-- BAD: div has zero meaning for screen readers -->
<div class="btn" onclick="submit()">Submit</div>

<!-- GOOD: button is announced as "Submit, button" -->
<button type="submit" onclick="submit()">Submit</button>
Submit (div)
Screen reader announces button as "Submit, button" so blind users know they can press Space/Enter to activate it. The div announces nothing.

ARIA Roles and Labels

ARIA (Accessible Rich Internet Applications) adds semantic meaning when HTML alone is not enough:

Example — ARIA Attributes
<!-- aria-label describes element for screen readers -->
<button aria-label="Close menu">X</button>

<!-- aria-hidden removes element from screen readers -->
<span aria-hidden="true">📸</span>

<!-- aria-expanded announces open/closed state -->
<button
  aria-expanded="false"
  aria-controls="menu">
  Open Menu
</button>
<nav id="menu" role="navigation">...</nav>
Screen reader announces "Close menu, button" instead of just "X, button" — much clearer for blind users.

Skip Navigation Link

Example — Skip to Main Content
<!-- First element on page — lets keyboard users skip nav -->
<a href="#main-content"
   class="skip-link">
  Skip to main content
</a>
<nav>...navigation links...</nav>
<main id="main-content">...</main>
Keyboard users press Tab first and can jump past the navigation menu directly to the main content. Every accessible website has this.
Key ARIA AttributesMost Used
aria-labelProvides a text label for screen readers when visible text is absent or unclear
aria-hidden="true"Hides decorative or duplicate content from screen readers
aria-expandedAnnounces open/closed state of menus, dropdowns, accordions
aria-requiredMarks a form field as required without relying on CSS only
aria-live="polite"Announces dynamic content changes (chat messages, alerts)
role="alert"Announces error messages immediately when they appear
tabindex="0"Makes non-interactive element focusable via keyboard Tab key
SEO: Accessibility Helps Rankings

Google's crawlers behave like screen readers — they cannot see images or run heavy JavaScript. Accessible HTML with proper semantic structure is crawled more efficiently and ranked better.

ARIA First Rule

Do not use ARIA if a native HTML element exists. Use a real <button> not <div role="button">. Native elements come with built-in keyboard support and accessibility for free.

Why Accessibility Matters

The UN Convention on the Rights of Persons with Disabilities (2006) recognizes digital accessibility as a human right. In many countries websites must be accessible by law or face significant legal penalties.

CIWeb HTML Course • 22 Lessons • Free

Explain with Analogies

Shiv AI explains this lesson using only real-life analogies. No code at all.

Click the Explain tab to generate analogies automatically.
index.html
Live Preview
Start coding - Shiv AI monitors automatically

What is the first rule of ARIA?

ExplanationUse native HTML elements first. A real button has built-in keyboard support and accessibility. Only use ARIA when no native HTML element can do the job.
Build Challenge
Accessible Page
Build an accessible page with skip link, aria-label on buttons, and properly labeled form inputs.
Requirements (5 to pass)
skip link
aria-label
button not div
aria-required or aria-label on input
main with id
solution.html
Preview
Community Wall
Lesson 18
0/500
0/20 lines
as
Recent Posts
Lesson 18 only

Support CIWeb + Get +50 AI Messages

Just Rs.11 gives you 50 extra Shiv AI messages and keeps CIWeb free for everyone.

AI
Shiv AI
Online