Accessibility

People reach the web in many ways. Some look at a screen and move a mouse. Some cannot see the screen and listen to it read aloud. Some never touch a mouse and move through a page with the keyboard, or with voice, or with a switch they press. Accessibility is the practice of building pages that all of them can use, and most of it comes down to writing HTML the way it was meant to be written.
Why accessibility matters
Accessibility means making sure everyone can use your page, whatever their circumstances and however they browse. Someone might not be able to see the screen and listen to it instead, through software that reads the page aloud. Someone might not use a mouse and move through the page with the keyboard. Someone might need larger text or stronger colours to read comfortably.
Think of a building with a ramp alongside the steps. The ramp helps people who cannot manage stairs, and it takes nothing away from anyone who can. Accessible HTML is the same idea: it opens the page to more people without making it worse for anyone.
The reassuring part is that HTML is accessible to start with. You get most of the way there for free by using the right element for each piece of content.
Semantic HTML as the foundation
The single most effective thing you can do for accessibility is to use the element that matches the meaning of the content, rather than a generic one styled to look right.
Semantic HTML means choosing a tag for what the content is, not for how it looks. A heading uses <h1> to <h6>. A button uses <button>. A link uses <a>. A list uses <ul> or <ol>. Each of these already carries meaning that a screen reader can announce, so a listener knows "this is a button" or "this is a heading" without seeing it.
It is like labelling boxes when you move house. A box marked "kitchen" helps whoever carries it, not only the person who packed it. Semantic tags label your content in the same way, so the browser and assistive technology know what each part is.
In practice this means reaching for <button> when you want a button, not a <div> you have styled to look like one. The <div> can be made to look identical, but it says nothing about what it is. The Semantic HTML chapter goes through the full set.
<button> for a button, <h1> for a heading, <a> for a link. Each one already tells a screen reader what it is, so you get that for free. A styled <div> can look the same and still say nothing. Text alternatives, labels, focus, and keyboard
Some content cannot speak for itself. An image is invisible to a screen reader until you describe it. A form field is a guess until it is labelled. And a page that only responds to a mouse leaves out everyone who does not use one. These four areas are where a little care goes a long way.
A handful of reliable habits cover most of this:
- Images need alt text. The
altattribute describes a picture for anyone who cannot see it. If the image is only decorative, an emptyalt=""tells the screen reader to skip it.
<img src="red-fox.jpg" alt="A red fox curled up asleep in the snow">- Form fields need labels. A
<label>tells both the visitor and the screen reader what to type in a field.
<label for="email">Email address</label>
<input id="email" type="email">- Buttons and links need clear text. "Read more" on its own is unclear when read out of context; "Read more about ticket prices" makes sense on its own.
- Keyboard order should match reading order. Someone pressing Tab moves through the page in the order the elements appear in your HTML, so keep that order sensible.
The Images and media and Forms and inputs chapters go deeper on alt text and labels.
alt, give form fields a <label>, write button and link text that makes sense on its own, and keep the tab order matching the reading order. None of them take long. Decorative images get an empty alt="" so they get skipped. ARIA, and why not to reach for it first
There is a set of HTML attributes made specifically for accessibility, called ARIA. It is useful in the right place, and it is one of the most misused parts of the platform, so it is worth understanding both what it does and when to leave it alone.
ARIA stands for Accessible Rich Internet Applications. It is a set of extra attributes you can add to an element to tell assistive technology more about it. The name makes it sound like the first tool to reach for, and it is usually the last.
The reason is simple: most of what ARIA can describe, HTML already says on its own. A <button> is already announced as a button. Adding role="button" to it changes nothing. If you find yourself adding ARIA to explain what an element is, that is usually a sign to swap in the plain HTML element that already says it.
Picture a sticky note added to a moving box. If the box is already printed "kitchen", a sticky note reading "kitchen" only adds clutter. Save the note for the box that has no label of its own. ARIA is for the parts of a page that HTML has no element for, which is rarer than it sounds.
<button> already says it is a button. Save ARIA for the rare part of a page that HTML has no element for, and keep everything else plain. A quick self-audit
You do not need specialist software to catch the most common problems. A few checks with tools already on your machine find the majority of them, and they take only a couple of minutes to run.
Here is a short checklist you can run on any page:
- Set the mouse aside and press Tab. Can you reach every link and button, in an order that makes sense? Can you activate them with Enter?
- Does every image have an
altattribute? - Does every form field have a
<label>? - Do your buttons and links still make sense when read on their own?
- Is the text clear to read against its background?
Running these on your own page is quick, and it catches the problems people hit most often. If the Tab key gets stuck somewhere, or an image has no alt, you have found something worth fixing.
alt, every field has a <label>, and the text reads clearly against its background. A couple of minutes of this catches the problems people hit most. 
