Lesson 4 of 8

Accessibility

Goal

An interface people can use without seeing the screen

01

Explanation

Few lessons make a bigger difference than this one. Millions of people use the web with a screen reader or with the keyboard alone, and four things are enough to make your interface easy for them to use.

Link the label to the field: when you connect <label for="x"> to <input id="x">, the screen reader reads the label along with the field, and everyone gets a bigger area to click.

A name for every button: a screen reader announces an icon-only button as just “button”, with nothing to say what it does. The aria-label attribute gives it a name.

Decorative images: the value alt="" tells the screen reader to skip the image, while leaving out alt altogether makes it read out the file name.

A visible focus indicator: anyone moving between elements with the Tab key needs to see which element has focus right now.

02

Your task

Apply these four things to the code.

Checks

5 checks
  1. The label is linked to the field through for and id
  2. The browser sees that the field has a label
  3. The icon-only button has a name to read out
  4. The decorative image has an empty alt, not a missing one
  5. The focus indicator is defined with :focus-visible
03

Hints

0/3
Track lessons0 of 8 done

Learn page layout, form validation, motion and accessibility: the things that make an interface comfortable to use in real life, not just nice to look at.

Advanced level, 8 lessons, 2 hours in total.

index.html
Preview
index.html100%
–/5

Press “Run and check” to grade your code.

5 checks listed under “Your task”.

Track lessons0 of 8 done

Learn page layout, form validation, motion and accessibility: the things that make an interface comfortable to use in real life, not just nice to look at.

Advanced level, 8 lessons, 2 hours in total.