Front End Help

Accessible Tables

We don’t use many tables in the Archive, but it’s worth knowing how to write them well. A table is the right way to mark up three or more pieces of information in a matrix for cross referencing. It is not the right way to do anything else.

Structure

The following is an example of a table that might appear inside a form, which is a design pattern frequently found in the tag wrangling and admin areas of the Archive. Whether or not a table appears in a form, it should be structured in a similar way. Note that the header (<thead>) and footer (<tfoot>) are at the top of the table, below the caption (<caption>) and above the body (<tbody>).

<table summary="Explain what the table does, list the data types it shows, and what you can do with them">
	<caption>Ten words or fewer!</caption>
	<thead>
		<tr>
			<th scope="col">Heading</th>
			<th scope="col">Heading</th>
			<th scope="col">Heading</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<th scope="row" colspan="2">Whole table operator</th>
			<td><input type="submit"></td>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<th scope="row">Row Heading</th>
			<td>Value</td>
			<td>Value</td>
		</tr>
	</tbody>
</table>

Some elements and attributes in detail

Things to remember

Going further with table accessibility

Our tables generally show lots of data, and not all text-to-speech agents support scope; we are considering titling our <td> elements in addition to scoping columns and rows, so users always know what property a table value relates to. It’s not clear whether this is useful or annoying. At the moment, there are some pilot tables which are both scoped and titled, in tag wrangling, our most used tabular data views. It would be very useful for someone to research this. If you use a screenreader regularly, your input is especially desired.

Resources