axe-core
axe-core copied to clipboard
"td-has-header" or no other rule fails when the 'headers' attribute on a <th> element is empty
td-has-header fails when <td> element has headers="" but not when <th> element has headers=""
Expectation: Flag <th> elements with headers=""
Actual: <th> elements with headers="" are not flagged
Motivation: There is a chance an author might have missed pointing the <th> (i.e. sub-heading) element to the parent header
Repro example:
<table>
<tr>
<th rowspan="2" id="h">Homework</th>
<th colspan="3" id="e">Exams</th>
<th colspan="3" id="p">Projects</th>
</tr>
<tr>
<th id="e1" headers="e">1</th>
<th id="e2" headers="e">2</th>
<th id="ef" headers="e">Final</th>
<th id="p1" headers="p">1</th>
<th id="p2" headers="">2</th>
<th id="pf" headers="p">Final</th>
</tr>
<tr>
<td headers="h">15%</td>
<td headers="e e1">15%</td>
<td headers="e e2">15%</td>
<td headers="e ef">20%</td>
<td headers="p p1">10%</td>
<td headers="p p2">10%</td>
<td headers="p pf">15%</td>
</tr>
</table>
axe-core version: 3.4.1-canary.6e4ed6b
axe-Coconut version: v4.2.1
Thanks for the issue.
I'm not sure this should fail. I don't think we can say that with any kind of certainty. I'd be more inclined to mark an empty headers attribute for review in the td-headers-attr rule instead. Perhaps we can include th elements in that rule?
@iamrafan any thoughts?