This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25575 - Element th is missing one or more of the following attributes: role.
Summary: Element th is missing one or more of the following attributes: role.
Status: RESOLVED INVALID
Alias: None
Product: HTML Checker
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Michael[tm] Smith
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-06 10:25 UTC by Atte Backman
Modified: 2017-06-16 18:57 UTC (History)
3 users (show)

See Also:


Attachments

Description Atte Backman 2014-05-06 10:25:27 UTC
With the following line validator throws incorrect error:

<th style="font-weight: normal; width: 0px;" class="sorting_asc" tabindex="0" aria-controls="transfer-wizard_search_results_from" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Tilinumero: activate to sort column ascending">foobar</th>

Element th is missing one or more of the following attributes: role.

However, I believe role is not allowed in element th?
Comment 1 Michael[tm] Smith 2014-05-07 09:13:03 UTC
(In reply to Atte Backman from comment #0)
> With the following line validator throws incorrect error:
> 
> <th style="font-weight: normal; width: 0px;" class="sorting_asc"
> tabindex="0" aria-controls="transfer-wizard_search_results_from" rowspan="1"
> colspan="1" aria-sort="ascending" aria-label="Tilinumero: activate to sort
> column ascending">foobar</th>
> 
> Element th is missing one or more of the following attributes: role.
> 
> However, I believe role is not allowed in element th?

The current spec says that <th> can have any role value:

  http://www.w3.org/html/wg/drafts/html/master/tabular-data.html#the-th-element

But the spec only allows the aria-sort attribute for elements that have either role=columnheader or role=rowheader. So you need to something like this:

<table role=grid>
<tr role=row>
<th role=columnheader style="font-weight: normal; width: 0px;" class="sorting_asc" tabindex="0" aria-controls="transfer-wizard_search_results_from" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Tilinumero: activate to sort column ascending">foobar</th>
...

If that doesn't solve your problem, please feel free to re-open this bug.
Comment 2 Craig Francis 2014-07-22 13:12:02 UTC
Isn't the role implied:

http://www.w3.org/TR/wai-aria/roles#columnheader

Base Concept: HTML th[scope="col"]

i.e. why take a th[scope="col"] and add a role of columnheader, when the role is already known.

As far as I'm aware, the role attribute is for when incorrect HTML is being used, perhaps being generated by JS with spans?
Comment 3 Craig Francis 2014-07-23 09:39:41 UTC
Ok, this is more of an issue that needs to be resolved with HTML than the validator:

http://lists.w3.org/Archives/Public/www-validator/2014Jul/0014.html
Comment 4 dmacdona 2017-06-16 18:57:14 UTC
I filed a but against HTML. 
https://github.com/w3c/html/issues/909#issuecomment-308889446


Editor Steve Faulkner said that <th> does indeed have semantics as shown in the accessibility API mappings doc.

https://w3c.github.io/html-aam/#el-th

Therefore, this should pass the validator

<th aria-sort="ascending" ...>

It should not require a redundant aria role="columnheader"