Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
scribetw opened this issue Aug 17, 2020 · 4 comments
Closed
Assignees
Labels
fix Bug fixes good first issue For first-time contributors rules Issue or false result from an axe-core rule
Milestone

Comments

@scribetw
Copy link

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 
@straker
Copy link
Contributor

straker commented Aug 17, 2020

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.

@straker straker added fix Bug fixes rules Issue or false result from an axe-core rule good first issue For first-time contributors and removed good first issue For first-time contributors labels Aug 17, 2020
@straker
Copy link
Contributor

straker commented Aug 19, 2020

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.

@padmavemulapati
Copy link

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

@straker
Copy link
Contributor

straker commented Sep 24, 2020

No docs required

@straker straker closed this as completed Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes good first issue For first-time contributors rules Issue or false result from an axe-core rule
Projects
None yet
Development

No branches or pull requests

4 participants