WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: SCOPE

for

From: Birkir R. Gunnarsson
Date: Oct 22, 2024 3:55AM


Any <th> cell in the first row in a table has an implicit scope of "col".
(i.e. column header)
Any <th> cell in the first column in a table (not counting the first row)
has an implicit scope of "row".
Adding a scope attribute to those cells typically does not change
accessibility support, in my experience.
(I have not yet looked at the latest experiments from the mighty WebAIM
team)


You do need a scope attribute for
* Any <th> cell that is not in the first row or first column in the table,
(scope="col" for a column header, scope="row" for a row header)
* Any <th> cell that spans multiple columns or rows,
* use the scope attribute with values of colgroup or rowgroup respectively
and use the colspan or rowspan attributes to indicate number of columns or
rows spanned
* <th scope="colgroup" colspan="3">I am a column header cell spanning 3
columns</th>
* <th scope="rowgroup" rowspan="3">I am a header cell spanning 3 rows</th>
You need to do this regardless of the location of the <th> cell in the
table.

I disagree that a table with only column or row headers fails WCAG 1.3.1,
it all depends on
I) Whether a cell is visually emphasized
II) If the table has a natural candidate

A table needs either column or row header cells, usually it needs column
header cells, but it does not necessarily need both.

Since screen readers read header cells in context, you don't want those
cells to be too wordy.

Imagine that you have a table of transactions. The first column is a
30-digit transaction ID, Then you have the columns date, amount, from
account and to account.
The transaction number doesn't tell you anything, and you don't want to be
forced to hear it every time you navigate between rows, so it's a terrible
candidate for a row header.
Any one or more of the amount, date, or from account columns would be
acceptable row header candidates, though they don't tell the whole story,
probably date and amount would work together as row headers

I would personally prefer not having a row header in that table.

Actually what I do want is for screen reader users to set their own row
header cells, but that would be a screen reader functionality.