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

Rule idea: Table has accessible name #2603

Open
WilcoFiers opened this issue Oct 28, 2020 · 1 comment
Open

Rule idea: Table has accessible name #2603

WilcoFiers opened this issue Oct 28, 2020 · 1 comment
Labels
feat New feature or enhancement rules Issue or false result from an axe-core rule
Milestone

Comments

@WilcoFiers
Copy link
Contributor

Most screen readers have the ability to navigate by table and to pull up a list of tables. In navigating a page that way it is helpful to make sure all tables have an accessible name. It is therefore a best practice for all tables to have an accessible name.

We need to do some testing to figure out what types of tables will be navigated / listed by screen readers. Native <table> elements definitely. I'm not sure if elements with role="table" and/or role="grid" are too. If they do. We'll need to gather some test data about this before we can write this rule.

@WilcoFiers WilcoFiers added feat New feature or enhancement rules Issue or false result from an axe-core rule labels Oct 28, 2020
@WilcoFiers WilcoFiers added this to the axe-core 4.2 milestone Oct 28, 2020
@WilcoFiers WilcoFiers modified the milestones: axe-core 4.2, axe-core 4.3 Feb 24, 2021
@WilcoFiers WilcoFiers modified the milestones: axe-core 4.3, Axe-core 4.4 May 12, 2021
@WilcoFiers WilcoFiers modified the milestones: Axe-core 4.4, Axe-core 4.5 Nov 10, 2021
@WilcoFiers WilcoFiers modified the milestones: Axe-core 4.5, Axe-core 4.6 May 19, 2022
@WilcoFiers WilcoFiers modified the milestones: Axe-core 4.6, Axe-core 4.7 Nov 2, 2022
@WilcoFiers WilcoFiers modified the milestones: Axe-core 4.8, Axe-core 4.9 Jun 29, 2023
@Wildebrew
Copy link

As mentioned in issue 4697 there is an odd discrepancy between HTML and ARIA in this regard.

HTML does not require that a <table> element has a <caption> but the ARIA spec requires that an element with the table role has an accessible name (see section 5.2.8 and the definition for the table role).

As someone who has depended on a screen reader for over 30 years I find this requirement nice but not "supremely necessary".

My recommendation fow ehen this would be required:

  • Any <table> element that does not have role="presentation" or role="none"
  • Any <table> element that does not pass the layout table algorithm: That is any <table> with a <th> cell, a cell with role="columnheader" or cell with role="rowheader".

Include ARIA based tables:

  • Any element with role="table"
  • Any element with role="grid"
    (authors that use the table role explicitly are very likely intending to build a table or grid)

Note: For ARIA table or grid roles you could also require at least one descendant with a columnheader or rowheader role), though I believe the layout algorithm guess is not performed for ARIA tables or grids.

As for rule severity, I'd recommend moderate. Users are not used to accessible names for tables.
More specifically, I would recommend that an accessible name is required for a table only when there are two or more tables on the page, but that goes against the ARIA spec and could also create confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or enhancement rules Issue or false result from an axe-core rule
Projects
None yet
Development

No branches or pull requests

2 participants