WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: using role="columnheader" instead of <th>


From: glen walker
Date: Oct 26, 2021 11:18PM

As I said originally, we can't change the elements.
Scope attribute is only valid on <th>, not <td>
I've tested it with screen readers so it appears ok. It just feels weird so
I was tossing it out there. I suspect it'll work just fine.

On Tue, Oct 26, 2021 at 10:59 PM David Engebretson Jr. <
<EMAIL REMOVED> > wrote:

> First, why can't you change the top row to be a TH?
> Also, can't you use the scope attribute? (
> https://www.w3resource.com/html/attributes/html-scope-attribute.php)
> Second, do you have a sample you can provide so that us native screen
> reader users can take a peek?
> Thanks!
> -----Original Message-----
> From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of
> glen walker
> Sent: Tuesday, October 26, 2021 6:33 PM
> To: WebAIM Discussion List < <EMAIL REMOVED> >
> Subject: [WebAIM] using role="columnheader" instead of <th>
> Technically you can make a fully accessible table without using semantic
> table elements provided you specify all the appropriate roles.
> I have a situation where <table> elements *are* being used but the
> structure of the code can't be changed (the element types can't change) but
> attributes can be added. In order to add row and column headers to the
> table, we are adding role="columnheader" or role="rowheader" on existing
> <td> elements.
> Now, ignoring the second rule of ARIA (
> https://www.w3.org/TR/aria-in-html/#second), although it says "unless you
> really have to", do you see any problem with having <td
> role="columnheader">? It looks weird but in theory it should behave like a
> <th scope="col">. Testing I've done with it seems to work. I didn't
> expect it *not* to work but it just looks and feels weird.
> > > at http://webaim.org/discussion/archives
> >
> > > > >