SIA-R77Data cells are assigned at least one header cell

Accessibility requirements

This rule tests conformance of the following accessibility requirements:

Description

This rule checks that the data cells in a table are assigned to at least one header cell.

Applicability

This rule applies to every <td> element in the HTML namespace for which all the following are true:

Expectations

  1. Each data cell corresponding to the test target is assigned to at least one header cell.

Assumptions

Accessibility support

This rule has the following accessibility support concern:

  • Table markup and header cell association is not well supported by some popular assistive technologies.

Background

While it is possible to build tables solely through ARIA roles, e.g. with <div role="row"> and <span role="cell">, these will not be detected as HTML tables due to non-interference with the host language. Therefore, the algorithm for forming tables will not be run and no cell-header association will happen. As a result, this rule ignores such tables. Note that these tables have no structure conveyed to assistive technologies and should not be used.

Examples

Passed

Both data cells in this <table> element are assigned to one header cell:

<table>
    <caption>Opening hours</caption>
    <tr><th>Mon-Fri</th><td>8-17</td></tr>
    <tr><th>Sat-Sun</th><td>10-14</td></tr>
</table>

Both data cells in this <table> element are assigned to one header cell:

<table>
    <caption>Opening hours</caption>
    <tr><th>Mon-Fri</th><th>Sat-Sun</th></tr>
    <tr><td>8-17</td><td>10-14</td></tr>
</table>

Failed

The second data cellin this <table> element is assigned to no header cell:

<table>
    <caption>Opening hours</caption>
    <tr><th>Mon-Fri</th></tr>
    <tr><td>8-17</td><td>10-14</td></tr>
</table>

Inapplicable

This <table> element is neither visible nor included in the accessibility tree:

<table hidden>
    <caption>Opening hours</caption>
    <tr><th>Mon-Fri</th><th>Sat-Sun</th></tr>
    <tr><td>8-17</td><td>10-14</td></tr>
</table>

The table corresponding to this <table> element contains no header cell:

<table>
    <caption>Opening hours</caption>
    <tr><td>8-12</td><td>13-17</td></tr>
</table>

Implementation Details

When deciding whether a <th> whose scope attribute is in the auto state is a column header or row header, empty data cells are ignored by this rule. This in turn impacts header assignment, since these cells may now be assigned as headers. Most User Agents and Assistive Technologies likewise ignore empty data cells. It is a common practice to have an empty data cell in the top-left corner of tables with both columns and rows headers.