Basic

What accessibility is for

Accessibility is not a style preference. It is the set of things a page must do so that people who are not using a mouse and eyes can still get the same result. The list is short, and most of it is HTML you already know how to write.

What you will see

Every clickable thing is reached, in visual order. If one is skipped, it is not focusable.

About 2 min of reading

Try It

Measure what the page announces

1

Find the controls

grep -cE '<(button|a)[ >]' index.html

Before you run it, say out loud what it will print. Then open the answer.

What it prints
A count of native controls. Compare it to how many clickable things the page has.
2

Find the fakes

grep -cE 'onclick|addEventListener\(.click' index.html

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Zero is the goal. Any hit is a div acting as a control, which has no name and no keyboard path.
3

Find images with no name

grep -cE ']*alt=' index.html; grep -cE '

Before you run it, say out loud what it will print. Then open the answer.

What it prints
The two counts should be equal. Every img needs alt, even alt="" for decoration.
4

Tab through it

open index.html in a browser and press Tab until the cycle repeats

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Every clickable thing is reached, in visual order. If one is skipped, it is not focusable.
Do not add tabindex to fix ordering. Fix the document order; tabindex greater than zero creates an order nobody can maintain.

Data Flow

Markup to an announcement
1 Browser computes role from the element
↓
2 Browser computes a name from content or alt or label
↓
3 Assistive tech reads role plus name plus state
↓
4 User decides whether this is the control they want
Why this works
The four things every page needs

A name for each control, a keyboard path to each control, a reading order that matches the visual order, and a visible focus indicator. Those four cover most failures an audit finds.

What it is not

It is not a substitute for clear writing, and it is not a legal checkbox. It is a contract about the interface: the same result must be reachable through more than one input channel.

Examples

Keyboard is the test

If a task cannot be done with Tab and Enter alone, it cannot be done by a screen reader, a switch device, or someone using a keyboard because a mouse is hard for them. Keyboard is the cheapest proxy for the whole class.

Native elements carry the behavior

<button> is focusable, pressable with Enter, announces itself as a button, and is disabled by disabled. A <div> with a click handler has none of that. The element choice is most of the fix.

The name comes from the markup

Assistive technology reads a computed name and role for each interactive thing. That name comes from text content, alt, or aria-label. No name means the announcement is a file path or nothing at all.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

Next Lesson
Names, alt text, and empty alt
Names, alt text, and empty alt →