Accessible complex forms and tables
More complex forms and tables require relationships that remain clear when read linearly or navigated by control.
✓ What you will learn in this topic
- Explain the purpose of Accessible complex forms and tables in a real HTML document.
- Choose and apply the elements shown in both examples.
- Recognize the specific mistake described in this lesson.
Concept explanation
Group related inputs with fieldset and legend, identify required fields in text, and associate errors with their controls. For tables, use captions and row or column headers; complex multi-level headers may require id and headers associations. Do not make a table visually understandable only by color or position. Test the form and table with keyboard focus order and a screen readerâs form or table navigation.
Syntax
Use native grouping and header relationships first; add explicit id/headers only when simple scope cannot express the table.
Example 1: a small page
Legend names the group and each choice remains a native, labeled radio button.
<fieldset>
<legend>Choose a delivery method</legend>
<label><input type=\"radio\" name=\"delivery\" value=\"pickup\"> Pickup</label>
<label><input type=\"radio\" name=\"delivery\" value=\"ship\"> Ship to me</label>
</fieldset>Expected result: A screen reader can announce the question context as the visitor moves through the choices.
Example 2: a practical page
The caption and scoped headers communicate which hours belong to each team.
<table>
<caption>Support hours by team</caption>
<thead><tr><th scope=\"col\">Team</th><th scope=\"col\">Weekdays</th></tr></thead>
<tbody><tr><th scope=\"row\">Billing</th><td>9:00â17:00</td></tr></tbody>
</table>Expected result: Users can navigate the table and hear the row and column context for each value.
Common mistakes
Do not infer accessibility from the presence of ARIA attributes or a passing automated scan alone.
Best practices
Combine semantic review, keyboard testing, screen-reader checks, and automated tools with real task scenarios.
Practice exercise
Audit a multi-step checkout form and data table. Test navigation without a mouse, verify names and states with a screen reader, and record fixes.
Lesson summary
- Native associations should express form groups, errors, captions, and table headers clearly.
- Combine semantic review, keyboard testing, screen-reader checks, and automated tools with real task scenarios.
Knowledge check
When should a complex table use explicit headers and id associations?
Show the explanation
Use them when multiple header levels create relationships that simple row or column scope cannot describe.
Practical example
html<fieldset>
<legend>Choose a delivery method</legend>
<label><input type=\"radio\" name=\"delivery\" value=\"pickup\"> Pickup</label>
<label><input type=\"radio\" name=\"delivery\" value=\"ship\"> Ship to me</label>
</fieldset>
Expected result:
A screen reader can announce the question context as the visitor moves through the choices.
Hands-on practice task
Audit a multi-step checkout form and data table. Test navigation without a mouse, verify names and states with a screen reader, and record fixes.
In this section
Other lessons in Accessibility Engineering
Broaden your knowledge