Why is this an issue?

The scope attribute tells assistive technology which cells a table header labels: it associates a th cell with the row(s) or column(s) it applies to, so a screen reader can announce the correct header when a user navigates through the data cells.

The HTML specification only defines scope on the th element: it is, in the words of the specification itself, "only conforming for th elements". Placing it on any other element does not associate that cell with anything, so users relying on assistive technology get no benefit from it, and the markup becomes invalid.

The td element is a special case: HTML4 allowed scope on a data cell, but HTML5 deprecated that usage, keeping scope valid only on th. Code that still carries scope on a td is most likely leftover from that older practice.

Move the scope attribute to the th element that acts as the header for the row, column, row group, or column group, or remove the attribute if the element is not a table header.

Custom elements and components (kebab-case tags, PascalCase Vue components) are not flagged, since scope may be an arbitrary prop unrelated to the native HTML attribute. The bare scope attribute on a template wrapper is also excluded, as none of these render as an actual table cell: Vue’s <template> (2.x scoped slots) or Angular’s <ng-template>.

Code examples

Noncompliant code example

<table>
  <tr>
    <td scope="row">Total</td>
    <td>42</td>
  </tr>
</table>

Compliant solution

<table>
  <tr>
    <th scope="row">Total</th>
    <td>42</td>
  </tr>
</table>

Resources

Documentation

Related rules