T1 HTML · Lesson 7
Accessibility
Who accessibility is for and WCAG's four principles; the names a screen reader says; working with the keyboard alone, with focus you can see; ARIA and its first rule; contrast, colour, zoom, captions and plain words; and testing a page the way its visitors use it.
- say who accessibility is for, and the four principles a page must meet
- give every image, control and region a name that a screen reader can say
- make every part of a page work with the keyboard alone, with a focus ring that shows where you are
- use ARIA only where HTML has no element for the job, and know its first rule
- meet the needs of people who see poorly, cannot hear or read slowly, and test a page the way they use it
The back cover
A ramp beside the steps of a railway station is built for wheelchair users. Then a parent with a pram uses it, a traveller with a heavy suitcase, and someone with a sprained ankle. Web pages work the same way: a page built for people who cannot see, hear, hold a mouse or read quickly works better for everyone.
These pages follow the parts of a page that a screen reader names aloud and a keyboard reaches. They cover contrast, colour, zoom and captions, for people who see less well or cannot hear. They show ARIA, the extra attributes that fill HTML's gaps, and its first rule.
The last part tests a page the way its visitors use it, from the keyboard alone to a real screen reader.
Before you start
The story: Three faults
Master Tobin is proud of your best panel, the tower notice for the Lamplighters' Fair. He asks Wren to test it before it goes up.
She fails it in three places. Her listening-glass cannot name the button with a lamp drawn on it. Using only the keys, she cannot reach the fair's sign-up at all. And the dates, printed in pale grey on white, are lost to old Mr Hollis the lamplighter, whose eyes are not what they were.
"A notice for the whole city," Wren says, "should work for the whole city."
Every lesson so far has had a piece of this one in it: alt text in lesson 3, table headings in lesson 4, labels in lesson 5, landmarks in lesson 6. This lesson brings those pieces together and adds the rest, so that a page works for everyone who visits it. It builds on these ideas; each has a tiny example.
| What you already know | A tiny example | Where it comes back |
|---|---|---|
| alt text describes a picture. | alt="A 5 kg bag of basmati rice"; alt="" for decoration. | It is one of the ways an element gets its name. |
| A label names its box. | <label for="mobile"> joined to id="mobile". | Every control needs a name a screen reader can say. |
| th and scope name table cells. | "Price, 180." | Structure that is in the HTML can be read aloud. |
| Landmarks and the skip link. | <main id="content"> and <a href="#content">. | Keyboard users move through a page in its own order. |
| details opens with the Enter key. | The browser makes it reachable with Tab. | Native elements bring keyboard support with them. |
| lang says the page's language. | <html lang="en">. | Screen readers use it to pronounce the words. |
| video with controls. | <video controls>. | Captions make it usable without sound. |
| DevTools' panels. | Elements, Network and the Accessibility pane. | Testing a page the way its visitors use it. |
| The browser shows no error for broken HTML. | A label pointing nowhere looks fine. | Most accessibility faults are invisible until you test. |
By the end of this lesson you will be able to:
- say who accessibility is for, and the four principles a page must meet;
- give every image, control and region a name that a screen reader can say;
- make every part of a page work with the keyboard alone, with a focus ring that shows where you are;
- use ARIA only where HTML has no element for the job, and know its first rule;
- meet the needs of people who see poorly, cannot hear or read slowly, and test a page the way they use it.
In one line
Accessibility makes a page work for everyone; you need the alt text, labels, table headings and landmarks of lessons 3 to 6.
Who it is for
At a glance
A ramp built for wheelchairs is used by prams, suitcases and sprained ankles too. Accessibility on the web works the same way. It means building a page that people can use whatever their abilities, and whatever they reach it with: a mouse, a keyboard, a screen reader, a phone in bright sun.
Needs come in four kinds: seeing, moving, hearing and understanding. Each can be permanent, last for a while, or come for a moment, like holding a baby in one arm. The world's agreed rules, WCAG, ask every page to be perceivable, operable, understandable and robust.
Take a guess: Who else uses a ramp that was built for wheelchair users?
A railway station with a ramp beside its steps is used by more people than the station planners first imagine. A wheelchair user, yes. But also a parent with a pram, a traveller dragging a heavy suitcase, a porter with a trolley, someone with a sprained ankle. The ramp was built for one group, and it serves everyone.
Building a page so that people can use it whatever their abilities and whatever they use to reach it: a mouse, a keyboard, a screen reader, a phone in bright sun. Developers often write it a11y: an a, 11 letters, then a y.
Four kinds of difference
| Kind | Some of the people | What they need from a page |
|---|---|---|
| Visual | people who are blind, have low vision, or are colour-blind | text alternatives for pictures, structure a screen reader can follow, enough contrast, text that can be enlarged |
| Motor | people who cannot use a mouse, have shaking hands, or use one finger or a mouth stick | everything usable with the keyboard, large targets, no need for fast or precise moves |
| Auditory | people who are deaf or hard of hearing | captions for video, transcripts for audio, nothing told only by sound |
| Cognitive | people with dyslexia, memory difficulties, or who read in a second language | plain words, a clear layout, the same menu in the same place, time to finish |
Permanent, for a while, or for a moment
A need is not always for life. The same need can be permanent, temporary or only for a moment.
| Need | Permanent | For a while | For a moment |
|---|---|---|---|
| using one hand | one arm | a broken wrist in a plaster | holding a baby, or a bag on a crowded bus |
| seeing the screen | blindness | an eye operation | bright sun on a phone screen |
| hearing | deafness | an ear infection | a noisy railway platform, or a sleeping child nearby |
This is why accessibility is not a favour to a few. On any day, a large share of a site's visitors are in one of these columns. A video with captions helps a deaf viewer, and also everyone watching on a silent train.
The rules: WCAG
The world's agreed rules for accessible pages are the Web Content Accessibility Guidelines, WCAG for short, written by the W3C, the group that writes many web standards. Governments use them. In India, the Rights of Persons with Disabilities Act of 2016 requires accessible websites, and government sites follow guidelines built on WCAG. The guidelines rest on four principles.
| Principle | It means | For example |
|---|---|---|
| Perceivable | everyone can take in the content, by some sense | alt text, captions, enough contrast |
| Operable | everyone can work the controls | everything works with a keyboard; nothing flashes |
| Understandable | the content and the controls make sense | plain words, clear labels, errors explained |
| Robust | it works with many browsers and assistive tools | real HTML elements, used for their meaning |
A memory aid
POUR: a page must be Perceivable, Operable, Understandable and Robust. Pour the content into every visitor's hands.
Each guideline has three levels: A (the minimum), AA (the usual target, which most laws ask for) and AAA (the highest). This course aims at AA.
Worked example 1
A cooking site's videos have no captions, and its Play button is a picture that works only with a mouse click. Which of the four principles does each problem break, and who does it shut out?
What we have: two problems on one page
What we need: the principle each breaks, and the people it affects
The plan: for each problem, ask: can people take it in (P), work it (O), understand it (U), and does it work with their tools (R)?
- No captions: deaf visitors cannot take in the spoken recipe. That breaks Perceivable. It also fails anyone watching without sound, such as on a train.
- A Play button that needs a mouse: people who use a keyboard cannot work it. That breaks Operable. It also fails anyone whose mouse has died.
No captions breaks Perceivable; a mouse-only button breaks Operable.
Check: each problem found its principle, and each shuts out a permanent group and a passing one too.
When you are stuck: who accessibility is for
Picture the visitor: what are they using, and what can they not do right now?
Run the four POUR questions: take it in, work it, understand it, works with their tools.
Remember the three columns: permanent, for a while, for a moment.
Your turn
What does a11y stand for?Tap to reveal
- Count the letters between the a and the y.
Accessibility: an a, 11 letters, a y.
Give a for-a-moment example of needing to use a page with one hand.Tap to reveal
- Think of a crowded bus.
Holding a bag or a baby, or holding on in a crowded bus.
What do the four letters of POUR stand for?Tap to reveal
- The four principles of WCAG.
Perceivable, Operable, Understandable, Robust.
Did you know?
One person in six
In March 2023 the World Health Organization estimated that 1.3 billion people experience significant disability. That is 16% of the world's population, or 1 in 6 people. The number is growing, partly because people are living longer. The WHO calls disability part of being human.
Why it fits here: The four kinds of need in this topic belong to about a sixth of the world, and their number is growing.
The web's inventor on who it is for
The W3C's introduction to web accessibility quotes Tim Berners-Lee, the inventor of the World Wide Web. In his words, the power of the Web is in its universality, and access by everyone regardless of disability is an essential aspect. The W3C launched its Web Accessibility Initiative on 7 April 1997, endorsed by the White House. The first Web Content Accessibility Guidelines became a W3C Recommendation on 5 May 1999.
Why it fits here: WCAG, the rules of this topic, began with those guidelines of 1999.
Sources: W3C WAI: Introduction to Web Accessibility; W3C: World Wide Web Consortium (W3C) Launches International Web Accessibility Initiative; W3C: Web Content Accessibility Guidelines 1.0
In one line
Accessibility serves visual, motor, auditory and cognitive needs, each permanent, temporary or momentary; WCAG asks pages to be Perceivable, Operable, Understandable and Robust (POUR), usually at level AA.
Every part needs a name
At a glance
Imagine helping a friend through a website on the phone. You cannot point; you can only say what things are called. A screen reader is in the same place. The browser builds a second copy of the page for it, the accessibility tree, where each part has a role, what kind of thing it is, and a name.
Links and buttons are named by their text, images by their alt, form boxes by their labels, and the whole page by its title. A name must say the purpose: three links called Click here leave a listener guessing.
Take a guess: On the phone, with no way to point, how would you tell a friend which button to press?
Imagine phoning a friend to help them through a website. You cannot point; you can only say what things are. "There is a link called Offers. Then a box called Mobile number. Then a button called Place order." A screen reader does exactly this, for every visitor who cannot see the screen. It can only say what the page tells it.
A second copy of the page that the browser builds alongside the one it draws. For each part it keeps a role (what kind of thing it is: link, button, heading, text box) and a name (what this one is called). Screen readers read this tree, not the colours on the screen.
The role comes from the element: an a with an href is a link, a button is a button, an h2 is a heading. That is one more reason the right element matters. The name comes from different places for different elements.
| Element | Where its name comes from | Example | A screen reader says |
|---|---|---|---|
| a link | its text | <a href="/offers">Offers</a> | "Offers, link" |
| a button | its text | <button>Place order</button> | "Place order, button" |
| an image | its alt | <img alt="Asha Stores logo" ...> | "Asha Stores logo, image" |
| a form box | its label | <label for="m">Mobile</label><input id="m"> | "Mobile, edit text" |
| the page | its title, in the head | <title>Offers | Asha Stores</title> | the name of the tab |
<a href="/offers">Offers</a>
<button>Place order</button>
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40'><circle cx='20' cy='20' r='18' fill='teal'/></svg>" alt="Asha Stores logo" width="40" height="40">
<label for="m">Mobile</label>
<input id="m" name="mobile" type="tel">
Checked in Chrome
- the link is named by its text
- the button is named by its text
- the image is named by its alt
- the box is named by its label
Each check reads the place the name comes from. If any of those places were empty, the screen reader would have nothing to say but the role: "link", "button", "image", "edit text". Imagine a page of twelve links, each announced only as "link".
A name must say the purpose
A name can exist and still fail. Three links named "Click here", or three buttons named "More", leave a listener guessing which is which. The name should say what the control does or where it goes, even when heard on its own: "Download the October bill", "More about toor dal".
A common mistake
A button or link whose only content is a picture with no alt, such as a magnifying glass for Search. On the screen it is clear. In the accessibility tree it is a button with no name. The fix is the picture's alt text, or, for a drawing written inside the button, an aria-label, which the ARIA section shows.
Two names for the whole page
Two attributes from lesson 2 matter here too. The page's title is the first thing a screen reader says when a page opens, so give each page its own: "Offers | Asha Stores", not "Asha Stores" on every page. And <html lang="en"> tells the screen reader which language to speak. Without it, a screen reader set to Hindi may read an English page with Hindi sounds; a paragraph in another language takes its own lang, as in lesson 2.
Worked example 2
A shop's header has three controls: a link holding only a logo picture whose alt is missing, a search box with only a placeholder, and a button whose only content is the word Go. Which of them has no name, or a poor one, and what is the fix?
What we have: three controls and where each would get its name
What we need: the faults and their fixes
The plan: for each control, find the place its name comes from, and ask whether it says the purpose
- The logo link: its only content is a picture, and the picture has no alt. So the link has no name. Fix:
alt="Asha Stores home", which names where the link goes. - The search box: a placeholder is not a label (lesson 5). So the box has no reliable name. Fix: a label, Search products, joined by for and id.
- The Go button: it has a name, but Go does not say what it does. Fix:
<button>Search</button>.
The logo link and the search box have no name; the button's name is poor. Add the alt, add a label, and rename the button Search.
Check: after the fixes, reading the three names aloud alone, "Asha Stores home", "Search products", "Search", tells a listener everything.
When you are stuck: names
For each control, ask: where does its name come from? Text, alt or label. Is that place empty?
Read the name aloud on its own: does it say what the control does?
Check the page's title and its html lang.
Your turn
Where does a button get its name?Tap to reveal
- Look at the table of names.
From its text.
What two things does the accessibility tree keep for each part?Tap to reveal
- What kind of thing it is, and what this one is called.
Its role and its name.
Why is "Click here" a poor link name?Tap to reveal
- Imagine hearing only the list of links.
It does not say where the link goes.
Did you know?
Most home pages leave something nameless
In February 2026 WebAIM checked the home pages of the top million websites. Images missing alternative text were found on 53.1% of them, form boxes missing labels on 51%, empty links on 46.3%, and empty buttons on 30.6%. Each of these is a part that a screen reader cannot name.
Why it fits here: Alt, labels and the text of links and buttons are the names of this topic, and more than half of these home pages missed one of them.
Don't use click here
The W3C keeps a short tip for web authors: don't use click here as link text. Its title gives the reason: not everyone will be clicking. The tip asks for brief but meaningful link text that gives some information when read out of context, explains what the link offers, and doesn't talk about mechanics.
Why it fits here: A name must say the purpose, the rule of this topic, and Click here says nothing about where a link goes.
In one line
The browser builds an accessibility tree of roles and names; links and buttons are named by their text, images by alt, form boxes by labels, and the page by its title. Every name must say the purpose.
Working with the keyboard alone
At a glance
Put the mouse away and try a website with the keyboard alone. Many people work this way every day: people who cannot hold a mouse steady, people whose screen reader runs on keys, and power users who are faster that way. Tab moves to the next thing you can use, and Enter and Space act on it.
Only some elements can take the focus: links with an href, buttons and form boxes, not a plain div. The Tab order follows the source order, a tabindex above 0 scrambles it, and the focus ring must always show where you are.
Take a guess: Without a mouse, how would you know where you are on a page?
Put your mouse away and try to use a website with only the keyboard. Many people do this every day: people who cannot hold a mouse steady, people whose screen reader runs on keys, and power users who are faster that way. If a page cannot be used this way, it is shut to all of them.
| Key | What it does |
|---|---|
| Tab | moves to the next thing you can use: a link, a button, a box |
| Shift + Tab | moves back to the previous one |
| Enter | follows a link, presses a button, sends a form |
| Space | presses a button, ticks a checkbox |
| Arrow keys | move between radio buttons in a group, or the options of a drop-down |
| Esc | closes a pop-up or a menu |
The one element on the page that the keyboard is working with right now. Tab moves the focus; Enter and Space act on the focused element. Only some elements can take focus.
Which elements take focus
<a href="/offers">Offers</a>
<button>Place order</button>
<input name="q">
<div>A plain box</div>
<a>A link with no href</a>
Checked in Chrome
- a link with an href takes focus
- a button takes focus
- a form box takes focus
- a plain div does not
- and nor does a link with no href
Each check asks the browser to move the focus to an element, then asks which element has it. The link, the button and the box take it. The div and the link with no href refuse: Tab skips them, and Enter cannot reach them.
This is why the elements you choose matter so much. A button made from a div, with a script for clicks, works for the mouse and for nobody else. A real button is reachable with Tab and pressed with Enter or Space, all for free.
A common mistake
A "Buy now" box built as <div class="buy">Buy now</div> with a script for clicks. The fix is <button>Buy now</button>, or a link if it goes to another page; CSS can make either look like anything.
The order of the Tab key
Tab moves through the page in the order the elements are written in the HTML: the source order. So write the HTML in the order a visitor reads the page, top to bottom, and the keyboard order will follow. If CSS later moves boxes around on the screen, the Tab order does not move with them, which is a reason to keep the two the same.
tabindex: changing what takes focus
| Value | What it does | Use it |
|---|---|---|
tabindex="0" | adds an element to the Tab order, in its source position | rarely: only for a custom control that has no native element |
tabindex="-1" | lets a script move the focus there, but Tab skips it | for a target the page moves focus to, such as a message box |
tabindex="1" or more | jumps the element ahead of everything else | never: it scrambles the order for everyone |
<div id="msg" tabindex="-1">Your order is placed.</div>
Checked in Chrome
- with tabindex="-1", a script can move the focus to the message
Moving focus to the message after an order is placed means a screen reader reads it at once, and a keyboard user carries on from there.
The focus ring: showing where you are
A keyboard user needs to see where the focus is, the way a mouse user sees the pointer. Browsers draw a focus ring, an outline around the focused element, whenever the keyboard is in use.
<a href="/offers">Offers</a>
Checked in Chrome
- the focused link gets the browser's focus ring
Removing the ring
Some designers dislike the ring and remove it with the CSS rule outline: none. Keyboard users are then lost on the page, pressing Tab with no idea where they are. Never remove it without putting a clear ring of your own in its place; the CSS step shows how to style it.
Worked example 3
A product page has a "Show reviews" control built as <span class="toggle">Show reviews</span>, which a script opens on click, and a link written as <a>Size guide</a> with no href, which a script also opens. Check both for keyboard use and fix them.
What we have: two controls that work only with a mouse
What we need: controls a keyboard can reach and use
The plan: test each: can it take focus? Then replace it with the native element for its job
<span class="toggle">Show reviews</span>
<a>Size guide</a>
Checked in Chrome
- (the slip: the span cannot take focus)
- (the slip: nor can the link with no href)
<details>
<summary>Show reviews</summary>
<p>4.5 stars from 120 buyers.</p>
</details>
<a href="/size-guide">Size guide</a>
Checked in Chrome
- the summary takes focus, and Enter opens it
- the link with its href takes focus
Make Show reviews a details with a summary (or a button), and give the size guide link its href.
Check: after the fix, both checks find that the focus lands on each control, so Tab reaches them and Enter works them.
When you are stuck: keyboard use
Put the mouse away and press Tab through the page: can you reach and use everything, and always see where you are?
Anything clickable that Tab skips is probably a div, a span or a link with no href; swap it for a button or a real link.
Never use a tabindex above 0, and never remove the focus ring without a replacement.
Your turn
Which key moves the focus back to the previous control?Tap to reveal
- Tab, with one more key held.
Shift + Tab.
Can a plain div take focus?Tap to reveal
- Look at the first block's checks.
No, not without a tabindex; that is why a clickable div fails keyboard users.
What does tabindex="-1" do?Tap to reveal
- Tab skips it, but something else can still focus it.
It lets a script move the focus there, while Tab skips it.
Did you know?
Why the key is called Tab
The word tab comes from tabulate, to arrange data in a table. Typing a table on a typewriter once meant pressing the space bar and backspace again and again. Typewriters then got a tabulator rack, and the tab key moved the carriage to the next tabulator stop. Frederic W. Hillard applied for a patent on such a machine on 22 August 1900.
Why it fits here: The Tab key of this topic still jumps to the next stop, now from one control to the next.
Sources: Wikipedia: Tab key; American Heritage Dictionary: tab; Google Patents: US720520A, Type-writing machine
When the focus ring shows
Browsers do not draw the focus ring every time. CSS gives the moments they do a name, :focus-visible, and its standard lists rules of thumb for them. If the user works the page with the keyboard, the standard says to show focus. If the user clicks with a mouse on an element that takes no typing, such as a button, it says not to.
Why it fits here: The focus ring of this topic follows those rules, which is why it appears when you press Tab.
Source: W3C: Selectors Level 4, the focus-indicated pseudo-class
In one line
Keyboard users move with Tab through the source order, and act with Enter and Space. Links with href, buttons and form boxes take focus, a div does not, tabindex above 0 is never right, and the focus ring must always show.
ARIA: filling the gaps, and its first rule
At a glance
Sometimes HTML has no word for what a page needs, or a picture stands for a word. ARIA is a set of extra attributes that speak straight to the accessibility tree. They change nothing on the screen, and nothing an element can do; they change only what assistive tools hear.
So its first rule is to use a real HTML element whenever one does the job. Three attributes then cover most needs: aria-label names a control that has no words, aria-hidden hides a decoration, and a box with role status reads out a change once the visitor pauses.
Take a guess: If a div is announced as a button, can it now be pressed with Enter?
Sometimes HTML has no element for what a page needs, or a picture alone stands for a word. For these gaps there is a set of extra attributes that speak straight to the accessibility tree. They change nothing on the screen; they change only what assistive tools hear.
Accessible Rich Internet Applications: a set of attributes, most starting with aria-, plus the role attribute, that add or change the roles and names in the accessibility tree.
The first rule of ARIA
If an HTML element already does the job, use it, not ARIA. A <button> is better than <div role="button">: the div with a role is announced as a button, but it still cannot take focus or be pressed with Enter until you write all of that in a script. ARIA changes what is said, never what an element can do.
Experts sum it up in one line: no ARIA is better than bad ARIA. With that rule in mind, three ARIA attributes cover most real needs.
aria-label: a name when there are no words
A search button showing only a magnifying glass drawing has no text, so it has no name. aria-label gives it one.
<button><svg width="16" height="16" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke="black"/></svg></button>
<button aria-label="Search"><svg width="16" height="16" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke="black"/></svg></button>
Checked in Chrome
- the first button has no text and no aria-label: no name at all
- the second is named Search, and a screen reader says "Search, button"
Where there are visible words, prefer them: a label, the button's text. aria-label is for when the screen shows a picture instead of a word, and the words would not fit.
aria-hidden: hiding what only decorates
The drawing inside each button above carries aria-hidden="true". That takes it out of the accessibility tree, so a screen reader does not try to describe a circle and a line. It is the same idea as alt="" for a decorative img in lesson 3, for things that are not img elements.
<p><span aria-hidden="true">★★★★☆</span> 4 out of 5 stars</p>
Checked in Chrome
- the stars are hidden from screen readers
- the words say the same thing for everyone
Without aria-hidden, a screen reader might read "black star, black star, black star, black star, white star". With it, it reads only "4 out of 5 stars".
Never hide something that can be used
aria-hidden="true" on a link or a button hides it from the screen reader, but a keyboard user can still Tab onto it, and hears nothing at all. Hide only decorations.
aria-live: announcing changes
When a page changes without loading again, "Added to cart", "3 results", a visitor who can see notices. A screen reader user does not, because the reader is busy elsewhere. A box marked with role="status", which carries aria-live="polite", tells the screen reader: when the words in here change, read them out, once the visitor pauses.
<p role="status" aria-live="polite">Toor dal added to your cart.</p>
Checked in Chrome
- the box is a status message
- changes are read out politely, without cutting the visitor off
The box must be on the page before its words change; a script then changes the words, which the JavaScript step does. Polite waits for a pause. Its stronger form, assertive, interrupts at once, and is for urgent warnings only.
| Attribute | What it does | Use it for |
|---|---|---|
aria-label | gives a name when there are no words to use | a button that shows only a drawing |
aria-hidden="true" | removes something from the accessibility tree | decorations: drawings, star symbols, dividers |
role="status" with aria-live="polite" | reads out changes to its words | "Added to cart", "Saved", search result counts |
role | changes what something is announced as | only for a custom control with no native element, and then with a script for its keys |
Worked example 4
A food app's cart button shows only a basket drawing, with a small number beside it for the items in the cart. When an item is added, the number changes. What does a screen reader user hear today, and what ARIA fixes it?
What we have: a picture-only button and a number that changes silently
What we need: a name for the button and an announcement for the change
The plan: name the button with aria-label; hide the drawing with aria-hidden; put the change in a status message
<button aria-label="Cart"><svg width="16" height="16" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke="black"/></svg></button>
<p role="status" aria-live="polite">2 items in your cart</p>
Checked in Chrome
- the button is named Cart
- the drawing is hidden
- the count is a polite status message
aria-label="Cart" on the button, aria-hidden on the drawing, and the count in a role="status" message.
Check: each fix fills a gap HTML has no element for: a name with no words, a drawing to skip, a change to announce.
A path that fails: Making the button a <div role="button" aria-label="Cart">. It is announced as a button, but Tab cannot reach it and Enter does nothing, which is exactly what ARIA's first rule warns about.
When you are stuck: ARIA
First ask: is there an HTML element that does this? If yes, use it, and stop.
No words on a control: aria-label. A decoration: aria-hidden="true". A change to announce: role="status".
Never put aria-hidden on anything a visitor can click or type into.
Your turn
What is the first rule of ARIA?Tap to reveal
- It is about HTML elements.
If an HTML element does the job, use it instead of ARIA.
Which attribute names a button that shows only a picture?Tap to reveal
- It starts with aria-.
aria-label.
Does role="button" on a div make it work with the keyboard?Tap to reveal
- ARIA changes what is said, never what an element can do.
No: it only changes what is announced. A real button works with the keyboard by itself.
Did you know?
No ARIA is better than bad ARIA
The W3C's guide to ARIA patterns opens its Read Me First page with a heading: No ARIA is better than Bad ARIA. WebAIM's February 2026 check of a million home pages found ARIA on 82.7% of them. Pages with ARIA averaged 59.1 detected errors, against 42 for pages without. WebAIM notes that ARIA did not necessarily cause them, since those pages were also more complex.
Why it fits here: The first rule of this topic, a real element before ARIA, keeps a page on the right side of these numbers.
Sources: W3C WAI ARIA Authoring Practices: Read Me First; WebAIM: The WebAIM Million, the 2026 report
A standard seven and a half years in the making
ARIA was first published on 26 September 2006. It took until 20 March 2014 for WAI-ARIA 1.0 to become a W3C Recommendation, a finished standard, seven and a half years later. Version 1.1 followed on 14 December 2017, and version 1.2 on 6 June 2023.
Why it fits here: The aria-label, aria-hidden and role attributes of this topic come from that standard.
Sources: Wikipedia: WAI-ARIA; W3C: Accessible Rich Internet Applications (WAI-ARIA) 1.0; W3C: Accessible Rich Internet Applications (WAI-ARIA) 1.1; W3C: Accessible Rich Internet Applications (WAI-ARIA) 1.2
In one line
ARIA attributes change only what assistive tools hear, so use a native element first. aria-label names a control with no words, aria-hidden hides decorations, and role="status" announces changes politely.
Seeing, hearing and reading
At a glance
Some visitors use the screen in the ordinary way but see it less well, cannot hear it, or read slowly. Small choices decide whether the page works for them. Text must stand out from its background: WCAG asks for a contrast of 4.5 to 1, or 3 to 1 for large text.
Nothing may be told by colour alone, since many people see some colours differently. The page must still work at 200 percent zoom. Videos need captions, recordings need transcripts, and plain words and a steady layout help everyone.
Take a guess: Who cannot tell which boxes are wrong when a form marks them only in red?
The last three sections were about tools: screen readers and keyboards. This one is about people who use the screen in the ordinary way but see it less well, cannot hear it, or read it slowly. Small choices decide whether the page works for them.
Contrast: text that stands out
Light grey text on a white page looks elegant in a design file and vanishes on a phone in the sun. Contrast is how much the text's colour stands out from the background. WCAG measures it as a contrast ratio, from 1 to 1 (no difference: white on white) up to 21 to 1 (black on white).
| Text | Level AA asks for at least | Read it as |
|---|---|---|
| ordinary text | 4.5 to 1 | four and a half times as bright, roughly |
| large text (about 24 pixels, or 19 pixels bold) | 3 to 1 | big letters can be paler |
<p class="pale" style="color: #999999">Free delivery above ₹499</p>
<p class="edge" style="color: #767676">Free delivery above ₹499</p>
<p class="dark" style="color: #595959">Free delivery above ₹499</p>
Checked in Chrome
- #999999 on white is about 2.85 to 1: too pale for ordinary text
- #767676 is about 4.54 to 1: just enough
- #595959 is about 7 to 1: comfortable
Each check reads the colour the browser actually used and works out the ratio against the white page, with the formula WCAG gives. The palest grey fails. The middle one, #767676, is the palest grey that passes on white, worth remembering. DevTools shows the ratio of any text when you pick its colour, so you never have to guess.
Never by colour alone
By common estimates, about 1 man in 12 sees some colours differently, most often red and green. A form that says "the boxes in red are wrong" tells them nothing. Always add words or a symbol: "Mobile number: enter 10 digits" beside the box, or an icon with its own text. The same goes for charts: label the lines, do not rely only on their colours.
Zoom and small screens
People with low vision enlarge the page, often to twice its size or more. A page should still work at 200 percent: no text cut off, no need to scroll sideways to read a line. The first step is in the head of every page:
<meta name="viewport" content="width=device-width, initial-scale=1">
This line, the viewport tag, tells a phone to lay the page out at its own width instead of pretending to be a desktop screen and shrinking everything. Never add user-scalable=no or a maximum scale to it: that stops visitors from zooming. Laying a page out so that it fits any width is called responsive design, and the CSS step teaches it.
Captions and transcripts
A video's speech must reach people who cannot hear it. Captions are the words of the speech, shown in time with the video. HTML adds them with a track element inside the video, pointing at a captions file in a format called WebVTT.
<video controls width="320" height="180" preload="none">
<source src="videos/poha.mp4" type="video/mp4">
<track kind="captions" src="captions/poha-en.vtt" srclang="en" label="English">
</video>
Checked in Chrome
- the video carries a captions track
- in English, said by srclang
- and listed in the player's menu as English
The player then offers a CC button to switch the captions on. For audio with no picture, such as a podcast, give a transcript: the whole text, on the page or a link away. Transcripts also help everyone who would rather read, and search engines, which cannot listen.
Plain words and a steady layout
Some visitors read slowly, read in a second language, or lose their place easily. What helps them helps everyone. Use short sentences in everyday words, and headings that say what follows. Keep the menu in the same place on every page, make links say where they go, and allow enough time to fill in a form, with errors explained in words.
Worked example 5
A delivery app shows its error for a wrong PIN code only by turning the box's border red, in a pale red, #FF8A8A, on white. Which needs does this fail, and what are the fixes?
What we have: an error shown only by a pale colour
What we need: the needs it fails and how to meet them
The plan: check it against colour alone, contrast, and plain words
- Colour alone: a visitor who cannot tell red from grey sees no error at all.
- Contrast: the pale red is about 2.3 to 1 on white, below even the 3 to 1 of large text, so people with full colour vision may miss it too.
- Words: nothing says what is wrong, so nobody knows what to fix.
<label for="pin">PIN code</label>
<input id="pin" name="pin" value="4110" aria-describedby="pin-error">
<p id="pin-error" class="err" style="color: #B00020">PIN code: enter 6 digits, for example 411001.</p>
Checked in Chrome
- the error text in #B00020 passes 4.5 to 1
- the error says in words what to do
- and aria-describedby ties it to the box, so a screen reader reads it with the box
It fails colour alone, contrast and plain words; add a dark, readable message that says what to do, tied to the box.
Check: the check computes the message's contrast in the browser, and the words would help even on a black-and-white screen.
When you are stuck: seeing, hearing and reading
Read the page in grey: does anything depend on colour alone?
Check every text colour's contrast in DevTools: 4.5 to 1 for ordinary text, 3 to 1 for large.
For every video, captions; for every recording, a transcript.
Your turn
What contrast ratio does level AA ask for ordinary text?Tap to reveal
- Look at the contrast table.
At least 4.5 to 1.
Why is "the fields in red are wrong" a poor error message?Tap to reveal
- Think of a visitor who sees red and green alike.
Because it relies on colour alone; say in words which field is wrong and why.
Which element adds captions to a video?Tap to reveal
- It goes inside the video, with kind="captions".
<track>.
Did you know?
The fault found most often
Low contrast text was the fault WebAIM found most often in its February 2026 check of a million home pages. Text below WCAG's AA contrast levels was on 83.9% of them, up from 79.1% in 2025. The average home page had 34 separate pieces of low-contrast text.
Why it fits here: The 4.5 to 1 rule of this topic is the one most often broken on the web.
Why more men than women
Colour blindness affects about 1 in 12 men but only about 1 in 200 women, some 300 million people worldwide. For most of them it is inherited, usually from the mother. The genes involved sit on the X chromosome, which is why men are affected so much more often.
Why it fits here: This is why this topic never tells anything by colour alone.
Sources: Colour Blind Awareness: About colour blindness; Wikipedia: Color blindness
In one line
Text needs a contrast of 4.5 to 1 (3 to 1 when large), and nothing may be told by colour alone. The page must zoom to 200 percent, videos need captions (track) and recordings transcripts, and plain words help everyone.
Testing a page the way its visitors use it
At a glance
Most accessibility faults cannot be seen by looking at a page: a label that points nowhere looks perfect. So a page is checked by using it the way its visitors do. Five tests run from the quickest to the deepest: the keyboard alone, zoom to 200 percent, DevTools, Lighthouse, and a screen reader.
Automatic tools are fast but cannot judge everything: a tool sees that an image has alt text, but only a person can tell whether it describes the picture. The deepest test is to watch real people use the page, and the cheapest habit is to build these checks into every step.
Take a guess: Can a tool tell whether an image's alt text really describes the picture?
You cannot see an accessibility fault by looking at a page, because most of them are not visual. A label that points nowhere looks perfect. So accessibility is checked by using the page as its visitors do. Five tests, from the quickest to the deepest, find almost everything.
| Test | How | It finds |
|---|---|---|
| 1. Keyboard only | put the mouse away; Tab through the page, use everything with Enter, Space and the arrows | controls Tab skips, a missing focus ring, a wrong order, traps you cannot Tab out of |
| 2. Zoom | press Ctrl and + until the page is at 200 percent | text cut off, boxes overlapping, sideways scrolling |
| 3. DevTools | the Accessibility pane of the Elements panel, and the contrast ratio in the colour picker | missing names, wrong roles, pale text |
| 4. Lighthouse | DevTools' Lighthouse tab: run its Accessibility check | a scored list of common faults it can detect by itself |
| 5. A screen reader | NVDA (free, on Windows), VoiceOver (built into Mac and iPhone), TalkBack (built into Android) | how the page really sounds: unclear names, a confusing order, silent changes |
Automatic tools such as Lighthouse are fast and worth running every time, but they cannot judge everything. A tool can see that an image has alt text; only a person can tell whether "image123" describes it. So the tests by hand, above all the keyboard test, stay necessary.
A tiny automatic checker
Here is what an automatic tool does, in miniature. The page below is built with this lesson's rules. The checks are rules a tool would apply, run against the page by the browser.
A page, checked by rules
<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8"><title>Offers | Asha Stores</title></head>
<body>
<a href="#content">Skip to main content</a>
<header><h1>Asha Stores</h1></header>
<main id="content">
<img src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40'><rect width='40' height='40' fill='gold'/></svg>" alt="This week's offer banner" width="40" height="40">
<label for="q">Search products</label>
<input id="q" name="q" type="search">
<button>Search</button>
</main>
</body>
</html>
Checked in Chrome
- rule 1: the page says its language
- rule 2: the page has a title
- rule 3: every image has an alt, even an empty one
- rule 4: every form box has a label
- rule 5: every button and link has a name
- rule 6: one h1 and one main
Every rule passes here. Change the page, say remove the label's for, and rule 4 would fail at once: that is how tools catch slips. Real tools, such as the one inside Lighthouse, apply many more rules of exactly this kind.
Testing with real people
The deepest test is to watch real people use the page, including people who use screen readers, switches or magnifiers every day. They find problems no tool and no developer would think of. Big companies and governments test this way before a major launch.
Building it into the work
Accessibility added at the end, just before launch, is slow and costly: whole parts must be rebuilt. Built in from the start, it costs almost nothing. In practice, that means a few habits:
- choose the native element first, every time;
- after building each part, Tab through it before moving on;
- run Lighthouse's check before each release, and fix what it finds;
- keep a short checklist in every code review: names, labels, keyboard, contrast, captions.
Worked example 6
A developer has five minutes to test a new sign-up page before a meeting. Which tests give the most for the time, and in what order?
What we have: five minutes and a new page
What we need: the tests that find the most faults fastest
The plan: start with what finds the most by hand, then let a tool sweep the rest
- Minute 1 to 3: the keyboard test. Tab through the whole form, fill it with keys only, send it. It finds the faults that lock people out entirely.
- Minute 4: Lighthouse's Accessibility check. It sweeps for missing labels, names and pale text in seconds.
- Minute 5: zoom to 200 percent and look for text cut off or boxes overlapping.
Keyboard first, then Lighthouse, then zoom; the screen reader test and real users come before the launch itself.
Check: the order puts first the test whose faults shut people out completely, and the quick tool second.
A path that fails: Running only Lighthouse and calling the page done. A tool cannot judge whether names make sense, or whether the order of the form is the order a person expects.
When you are stuck: testing
Start with the keyboard: it needs no tools and finds the worst faults.
Then let Lighthouse sweep, and read each item it raises.
Before any big launch, listen to the page with a screen reader.
Your turn
Why is the keyboard test usually the first one to run?Tap to reveal
- What does it need, and what kind of fault does it find?
It needs no tools, and it finds the faults that lock people out completely.
Can an automatic tool tell whether alt="image123" is good alt text?Tap to reveal
- It can see that the alt exists.
No: only a person can judge whether the words describe the picture.
Name a free screen reader for Windows.Tap to reveal
- It is in the table of tests.
NVDA.
Did you know?
What the tools missed
In February 2017 Mehmet Duran of the UK government's GDS accessibility team described a test. With his colleagues he built what they called the world's least accessible web page, with 143 barriers, and ran 10 automatic tools over it. Of the 143 barriers, 42, or 29%, were missed by all 10 tools, and even the best tool found only 41%. Their advice: combine tools with manual inspection and user research.
Why it fits here: This is why this topic tests with the keyboard, zoom and a screen reader, not with Lighthouse alone.
The screen readers people use
In WebAIM's survey of December 2023 and January 2024, screen reader users named their main desktop screen reader: JAWS for 40.5%, NVDA for 37.7% and VoiceOver for 9.7%. NVDA is free. Michael Curran began writing it in April 2006, and he and James Teh, both fully blind, founded the not-for-profit NV Access to support it. The two had met as children at a music camp for the blind.
Why it fits here: NVDA is the screen reader this topic suggests for testing on Windows, and it costs nothing.
Sources: WebAIM: Screen Reader User Survey #10 Results; NV Access: About NV Access
In one line
Test by using the page: keyboard only first, zoom to 200 percent, DevTools and Lighthouse, then a screen reader and real people. Build these checks into every step, since tools alone cannot judge everything.
Where it is used
Accessibility is part of every page, and in many places it is the law.
| What you learned | Where it is used | A real example |
|---|---|---|
| WCAG level AA | government and bank sites, large companies | Indian government websites follow guidelines built on WCAG |
| names, labels and alt | every form and every image | a bank's login page whose boxes a screen reader names one by one |
| keyboard use and the focus ring | every control | a ticket booking site used entirely with the keyboard by a person with a motor disability |
| aria-label and aria-hidden | icon buttons: search, cart, menu, close | a shopping app's basket button announced as "Cart, button" |
| role="status" | messages that appear without a page load | "Added to cart" read out after pressing Add |
| contrast | every text colour | a design system that lists only text colours passing 4.5 to 1 |
| captions and transcripts | videos, online classes, podcasts | an online course whose lecture videos carry English and Hindi captions |
| Lighthouse and the keyboard test | before every release | a team that fails a release when the Accessibility score drops |
Mistakes and debugging
Each of these looks fine on the screen and fails someone. Each check below shows the slip, as the kit sees it.
1. A clickable div
<div class="buy">Buy now</div>
Checked in Chrome
- (the slip: the div cannot take focus, so keyboard users can never press it)
The fix: <button>Buy now</button>.
2. A button with only a picture, and no name
<button><svg width="16" height="16" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke="black"/></svg></button>
Checked in Chrome
- (the slip: no text and no aria-label, so the button has no name)
The fix: <button aria-label="Search">, or visible words.
3. Pale text
Light grey such as #999999 on white is about 2.85 to 1, far from 4.5. The fix: #767676 or darker; check it in DevTools' colour picker.
4. The focus ring removed
The CSS rule outline: none on everything, to tidy the look. The fix: keep the browser's ring, or style a clear one of your own.
5. aria-hidden on something usable
<a href="/offers" aria-hidden="true">Offers</a>
Checked in Chrome
- (the slip: the link is hidden from screen readers but still reachable with Tab, so it is heard as nothing)
The fix: remove aria-hidden; hide only decorations.
6. ARIA instead of HTML
<div role="button">, <span role="link">. Each is announced correctly, and works with nothing but a mouse until you rebuild in a script what the native element does for free. The fix: the native element: button, a with href.
7. Errors and states told by colour alone
A red border as the only sign of a wrong answer. The fix: words that say what is wrong and what to do, tied to the box with aria-describedby.
The debugging corner: hear the page
Turn on your phone's screen reader for two minutes: TalkBack on Android (Settings, Accessibility) or VoiceOver on an iPhone. Swipe right to move from part to part and listen. Nothing teaches accessibility faster than hearing your own page read aloud.
Quick card
The lesson on one card.
Every idea of the lesson
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cart | Asha Stores</title>
</head>
<body>
<a href="#content">Skip to main content</a>
<main id="content">
<h1>Your cart</h1>
<button aria-label="Remove toor dal"><svg width="16" height="16" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke="black"/></svg></button>
<label for="qty">Quantity</label>
<input id="qty" name="qty" type="number" min="1" value="2" aria-describedby="qty-help">
<p id="qty-help" style="color: #595959">Up to 10 of each item.</p>
<p role="status" aria-live="polite">Cart updated.</p>
<button>Place order</button>
</main>
</body>
</html>
Checked in Chrome
- the language and the page's own title
- the picture-only button is named, its drawing hidden
- the box has its label and its help text
- changes are announced
- the order button takes focus from the keyboard
| Idea | In one line |
|---|---|
| POUR | Perceivable, Operable, Understandable, Robust; aim for WCAG AA |
| names | links and buttons by their text, images by alt, boxes by labels, the page by its title |
| keyboard | Tab, Shift + Tab, Enter, Space, arrows; native controls take focus; never tabindex above 0 |
| focus ring | always visible; never removed without a replacement |
| ARIA's first rule | a native element first; ARIA changes what is heard, never what works |
aria-label, aria-hidden, role="status" | a name with no words; hide decorations; announce changes |
| contrast | 4.5 to 1 for ordinary text, 3 to 1 for large; #767676 is the palest grey on white |
| colour | never the only sign |
<track kind="captions"> | captions for video; a transcript for audio |
| testing | keyboard, zoom, DevTools, Lighthouse, a screen reader, real people |
The story: For the whole city
You work through her three faults. The lamp button gets a name she can hear. The sign-up becomes a real button, so the keys reach it and press it, with a bright ring showing where you are. The pale dates turn dark enough to stand out, and you measure them to be sure.
Then you test it the way the city will use it: with the keys alone, with the glass, and with the text made twice as big. Wren passes it. Mr Hollis reads the dates from across the square. "Now that," he says, "is a notice."
Reagents gathered: accessibility tree, focus, ARIA, contrast ratio, POUR.
Sources
- MDN Web Docs (Prose CC BY-SA 2.5 or later; code samples added since 2010-08-20 CC0 (its licensing page, read 2026-10-26); reused with credit)
- HTML Living Standard (WHATWG) (CC BY 4.0: "Copyright WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0 International License" (its acknowledgements page, read 2026-10-26); reused with credit)