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

Spanning row/column example missing required attributes #308

Open
aardrian opened this issue Nov 17, 2020 · 5 comments
Open

Spanning row/column example missing required attributes #308

aardrian opened this issue Nov 17, 2020 · 5 comments
Assignees

Comments

@aardrian
Copy link

Looking at this page:
https://www.accessibility-developer-guide.com/examples/tables/spanning-rows-cols/

It shows <th>s that span but does not include the required id and headers attribute in the associated <th>s or <td>s.

Eg:

[…]
      <th colspan="2">
        Leisure Days
      </th>
    </tr>
[…]
      <th>
        Saturday
      </th>
      <th>
        Sunday
      </th>
    </tr>
[…]
      <td>
        Computer Science
      </td>
      <td>
        Chillout
      </td>
    </tr>

The content under the heading "Tricky screen reader navigation" makes assertions about how screen readers read this table, but those assertions are based on an invalid pattern.

Correct code might look like this:

[…]
      <th colspan="2" id="Leisure">
        Leisure Days
      </th>
    </tr>
[…]
      <th id="Sat" headers="Leisure">
        Saturday
      </th>
      <th id="Sun" headers="Leisure">
        Sunday
      </th>
    </tr>
[…]
      <td headers="Leisure Sat">
        Computer Science
      </td>
      <td headers="Leisure Sun">
        Chillout
      </td>
    </tr>

I have an example here:
https://adrianroselli.com/2017/11/hey-its-still-ok-to-use-tables.html#WCAGSpanning

Which is based on this WCAG example:
https://www.w3.org/TR/WCAG20-TECHS/H43.html

@backflip backflip self-assigned this Mar 22, 2021
@jmuheim
Copy link
Collaborator

jmuheim commented Feb 1, 2023

I never understood what the headers attribute is useful for in simple tables: the association between th and td is always given automatically, and I never experienced any issues with screen readers. As soon as tables get more complicated and therefore a headers attribute seems necessary, I usually discourage to create tables with such messy data anyway.

Or do I misunderstand something here?

@backflip backflip removed their assignment Feb 1, 2023
@aardrian
Copy link
Author

@jmuheim The headers attribute has no purpose in simple tables. It does have purpose in tables with spanning cells. However, the headers attribute has a stack of issues: https://adrianroselli.com/2022/01/accessible-cart-tables.html

As such, tables should generally avoid spanning cells when possible: https://adrianroselli.com/2023/02/avoid-spanning-table-headers.html

Sadly, those browser bugs I link are less likely to be fixed if people are not using the correct pattern.

@backflip backflip added the bug label May 8, 2023
@backflip backflip moved this to Todo in ADG May 12, 2023
@backflip backflip added this to ADG May 12, 2023
@backflip backflip moved this from Todo to In Progress in ADG May 12, 2023
@backflip backflip self-assigned this Sep 21, 2023
@backflip backflip moved this from In Progress to Testing ZFA in ADG Mar 5, 2024
@backflip
Copy link
Collaborator

And this has finally been fixed, too. Thank you so much, @aardrian, for the time you spent documenting these issues.

@github-project-automation github-project-automation bot moved this from Testing ZFA to Done in ADG Jul 25, 2024
@backflip
Copy link
Collaborator

On second thought: @LAST2024, could you please check whether https://www.accessibility-developer-guide.com/examples/tables/spanning-rows-cols/#tricky-screen-reader-navigation is still accurate when navigating https://www.accessibility-developer-guide.com/examples/tables/spanning-rows-cols/_examples/table-spanning-multiple-rows-and-columns/ in NVDA? The text:

The first thing to note is that NVDA does not announce when a cell spans multiple rows or columns! For example, the header cell "Work Days" (which spans 5 columns) is simply announced as "column 2 Work Days", and the next cell "Leisure Days" (which spans 2 columns) is announced as "column 7 Leisure Days". Did you notice the jump from 2 to 7? You have to be a pretty focused user to realise this.

The same holds true when navigating vertically. For example, when navigating from "Saturday" down to "Dancing", there is no hint by the screen reader that "Dancing" spans both "9:00" and "10:00", it only announces "9:00 row 3 Dancing". As there is no subsequent row (if it existed, it would be announced as "row 5", again with a jump from 3 to 5), not even vigilant users have the chance to realise by accident that "Dancing" spans 2 rows.

And one last thing to note: finding the cell "Chillout" is not that easy using a screen reader! If you are on the last row ("10:00") and then navigate from "Computer Science" rightwards to "Dancing" and then again to the right, then you will end on "Sleeping" which in fact is one row above! Sure, the screen reader announced the jump from row 4 to row 3 when coming to "Dancing", but still you have to be very vigilant to realise. So in fact, you only are able to reach "Chillout" by navigating down from "Sleeping".

@backflip backflip reopened this Jul 25, 2024
@backflip
Copy link
Collaborator

@LAST2024, I have created a follow-up where I replaced the outdated paragraphs: #448

I did test the example in NVDA 2024.2 / Firefox 128 and was unable to reproduce any of the listed limitations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants