validator icon indicating copy to clipboard operation
validator copied to clipboard

aria-selected on <td> descendant of <table role="grid">

Open HadleyLuker opened this issue 3 years ago • 0 comments

I believe that ARIA and ARIA in HTML permit the use of aria-selected="true" on a <td> if that <td> is a descendant of a <table role="grid"> element. However, the validator gives an error in this situation.

Steps to reproduce

Validate the following code (simplified from Date Picker Dialog Example - APG):

<table role="grid" aria-label="May 2023">
  <thead>
    <tr>
      <th scope="col" abbr="Sunday">Su</th>
      <th scope="col" abbr="Monday">Mo</th>
      <th scope="col" abbr="Tuesday">Tu</th>
      <th scope="col" abbr="Wednesday">We</th>
      <th scope="col" abbr="Thursday">Th</th>
      <th scope="col" abbr="Friday">Fr</th>
      <th scope="col" abbr="Saturday">Sa</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td tabindex="-1"></td>
      <td tabindex="-1">1</td>
      <td tabindex="-1">2</td>
      <td tabindex="0" aria-selected="true">3</td>
      <td tabindex="-1">4</td>
      <td tabindex="-1">5</td>
      <td tabindex="-1">6</td>
    </tr>
  </tbody>
</table>

Expected behavior

The validator should not give any errors for this code because it is valid according to ARIA and ARIA in HTML.

HTML in ARIA for <td> says that the implicit role of a <td> is

role=gridcell if the ancestor table element is exposed as a role=grid or treegrid

ARIA for gridcell lists aria-selected as a supported state on gridcell.

Actual behavior

The validator reports this error:

Element td is missing one or more of the following attributes: aria-checked, role.

HadleyLuker avatar Jun 12 '23 21:06 HadleyLuker