html · level 2 · unit 6 · lesson 3
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
aria-describedby joins to its box.
Help text tells visitors how to answer, such as At least 8 characters. People can see it next to the box, but a screen reader moving into the box only says the label.
Give the help text an id. Then add aria-describedby to the box, with that id as its value. Now a screen reader reads the label, then the help text.
Use the same trick for an error message, such as Choose a date in the future, so everyone hears what went wrong.
<form>
<label for="pass">Password</label>
<input type="password" id="pass" name="pass" minlength="8" aria-describedby="pass-help">
<p id="pass-help">At least 8 characters, with one number.</p>
<button>Create account</button>
</form> Press show my page to see it here.
The value and the id must match exactly, like for and id on a label.
guess first
What will a screen reader say in this box?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<label for="email">Email</label>
<input type="email" id="email" name="email" aria-describedby="email-help">
<p id="email-help">We only use it to send your tickets.</p>
your turn
Your turn. Join the hint to the box.
Give the help text on line 4 the id postcode-help, then point the box on line 3 at it with aria-describedby.
Press show my page to see it here.
- the box points to the help textnot checked yet
- the help text has the matching idnot checked yet
fix it
The help text is never read out. Can you fix it?
Press show my page to see it here.
- the help text has the matching idnot checked yet
- the box points to the help textnot checked yet
- The box points at an
id. Does any element have exactly thatid? - Compare
day-helpon line 3 with theidon line 4. Only one has a dash. - Change
id="dayhelp"toid="day-help", then press run.
nailed it
your hints reach every visitor. :D
- Help text says how to answer.
aria-describedbypoints a box at the help text'sid.- Screen readers read the label, then the help.
new words in your collection
- help text
This lesson isn’t saved. A free account remembers every lesson you finish.