Rule n° 242 - Cells in data tables are linked to their headers
Some Internet users vocalise web content using technical aids. A very clear picture on the screen can become totally incomprehensible in voice mode. However, it is quite easy to foresee this case.
Goal
- Allow technical aids to return the information contained in data tables in a comprehensible way, by informing users of the logical relationships between the table’s content and headers.
Solution technique
Use the HTML th element and its scope attribute to tag header cells and explain their scope (scope of col value for a column header, of row value for a row header).
For headers that only apply to part of a row or column, check systematically for the idattribute, for the th element and the headers attribute for the td elements with the appropriate values:
- Give each header (
thelement) an id attributeidattribute (for example,id="foo); - Use the
headersattribute in each cell (tdelement) to indicate the associated headers (for example,headers="foo"for each cell attached to the header having the attributeid="foo"). _ x000D__
To find out more:
Moyen de contrôle
In the generated code of data tables:
- Check the systematic use of the
thelement to tag row or column headers; - For headers applying to the whole of a row or a column, check that the
scopeattribute with the appropriate value (rowfor a row orcolfor a column) is systematically included; - For headers which only apply to part of a row or column, check that the
idattribute for thethelement and of theheadersattribute for thetdelements are systematically included with the appropriate values: - Each header (
th) element must have anid attribute(for example,id="foo"); - The headers attribute must be used in each cell (
tdelement) to indicate the associated headers (for example,headers="foo"for each cell attached to the header having theid="foo"attribute).