Axe-core: ARIA attribute is not allowed: aria-selected="true" on a gridcell element

Created on 17 Aug 2020  路  4Comments  路  Source: dequelabs/axe-core

https://a11ysupport.io/tests/html/aria_gridcell(aria-selected).html

<table role="grid">
    <tr>
        <th>
            Date
        </th>
        <th>
            Name
        </th>
    </tr>
    <tr>
        <td tabindex="0">
            2018-01-01
        </td>
        <td aria-selected="false" tabindex="0">
            target 1
        </td>
    </tr>
    <tr>
        <td tabindex="0">
            2018-01-02
        </td>
        <td aria-selected="true" tabindex="0">
            target 2
        </td>
    </tr>
</table>

Expectation: No "aria-allowed-attr" violation.

Actual: An "aria-allowed-attr" violation: Fix any of the following: ARIA attribute is not allowed: aria-selected="true"

Motivation:

  1. It passed in 3.5.5.
  2. According to this note, it is not necessary to use ARIA roles for rows and cells because the HTML elements have implied ARIA semantics.

axe-core version: 4.0.1
axe-webdriver, extension or other integration version: N/A

Browser and Assistive Technology versions
- Firefox Developer Edition 80.0b8 (64-bit)

For Tooling issues:
- Node version: N/A  
- Platform: macOS Catalina 10.15.6 
Good first issue fix rules

Most helpful comment

Thanks for the issue. The problem looks like we don't look for a parent grid in our implicit role calculation so the td is being resolved with a role of cell instead of gridcell.

All 4 comments

Thanks for the issue. The problem looks like we don't look for a parent grid in our implicit role calculation so the td is being resolved with a role of cell instead of gridcell.

The implicit role calculation needs to be updated for td by turning it into a function (rather than a string). The function accepts vNode as an argument. The function should look for the closest table element and look at its explicit role (getExplicitRole). If the role is grid or treegrid it should return gridcell, otherwise return cell.

No Aria attribute failure is seeing for table's data look for a parent grid so the td is being resolved with a role of cell instead of gridcell. Hence results now we can see in the passes with appropriate message even.
image

No docs required

Was this page helpful?
0 / 5 - 0 ratings