Skip to content

Accessible Frontend Development — Free Starter Lesson

Free software starter lesson · 15 minutes · Beginner. Build an email field with a visible label, an instruction, and a keyboard-accessible submit button.

1. Connect the label and instruction

In a local HTML practice page, add a visible label whose for value matches the input’s id. Give the instruction its own ID and reference it from the input with aria-describedby.

<form>
  <label for="email">Email address (required)</label>
  <input id="email" name="email" type="email" required
         aria-describedby="email-hint">
  <p id="email-hint">Use a sample address for this exercise.</p>
  <button type="submit">Check email address</button>
</form>

2. Test with the keyboard

Open the page in your browser. Press Tab to reach the email field and then the button. Confirm that you can see which control has focus. Leave the field empty and activate the button with Enter. The browser should prevent submission and identify the required field.

Try it yourself

Remove the label’s for attribute and click the label text. Restore it and click the label again. Compare what happens to keyboard focus. If you have a screen reader, check whether it announces the field name and instruction when you focus the input.

Self-check

The visible label should focus the email field when clicked. Tab should reach the input and then the button. The button should work from the keyboard, and the field should remain identifiable when it contains text.

Watch the Accessible Web Forms video for a companion overview.

Browse the other free starter lessons on Learning Progress.