WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: table cells, th-mapping

for

From: Jonathan Avila
Date: Mar 16, 2021 9:40AM


It's my understanding that the spec says the ids must point to TH cells themselves and not something else like a span inside of them.

https://html.spec.whatwg.org/multipage/tables.html#attr-tdth-headers

Jonathan

-----Original Message-----
From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of glen walker
Sent: Tuesday, March 16, 2021 11:21 AM
To: WebAIM Discussion List < <EMAIL REMOVED> >
Subject: Re: [WebAIM] table cells, th-mapping

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


In theory, yes, but I couldn't get headers to work with NVDA or JAWS. Both always read the entire header instead of what was in the headers attribute.

I had

<th><span id="foo">first</span>second</th>

then

<td headers="foo">1</td>

NVDA and JAWS (both chrome and firefox) would always say "first second"
when I navigated to the cell using the screen reader table navigation keys (ctrl+alt+arrow). I only expected to hear "first".

I would *not* recommend setting aria-hidden on "second" because, even though that would hide the text from the header, it would also make the text absolutely hidden from the screen reader. If you have text that is visible, it should be available to all users. Using the headers attribute should have hidden the extra text from the header but still allowed the screen reader to navigate to the header cell and read all the text.