You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
aria-sort forces role="columnheader" or rowheader Validation throws error on <th> #592
Said the issue is with wai-aria. Here's the issue:
using aria-sort requires role="columnheader" or rowheader
ARIA currently maps <th> to role="cell" which provides no appreciable semantics to distinguish a header from a data cell, forcing the author to use role="columnheader" or rowheader this is an extra step for authors.
This could be made simpler by introducing an new generic role="tableheader". This would be an optional role to the more specific rowheader and columnheader.
The A11Y API could then map the <th> to role="tableheader".
We could then allow authors to use <th aria-sort="ascending"> without burdening them with a role, because the <th> semantics would be sufficient.
The first rule of ARIA is to use generic HTML when possible. It seems with this minor tweak, we could make it easier for authors to use aria-sort. There are no implications on screen readers which already understand what the th does. They ignore the unhelpful role="cell" mapping in the API.
I think scope doesn't do that much these days, but its good to know that Safari changes the role to column header instead of the unhelpful role="cell"
We "could" say:
th with scope="col" map to role="columnheader"
th with scope="row" map to role="rowheader"
th inside thead map to role="columnheader"
I think we should do that, but that still requires the author to add the scope or thead.
I think the addition a new role="tableheader" will be the most elegant because it would allow the implicit mapping of th to that role, and then the author could simply do <th aria-sort="ascending">
@hartman We wrote that technique about 15 years ago, in the early days of WCAG. Screen readers have largely overcome the need for scope except in limited situations.
Activity
hartman commentedon Jun 29, 2017
Just wondering, but i'm guessing that scope is not really affecting this either is it ? Should it ?
https://www.w3.org/TR/wai-aria-1.1/#columnheader
base concept:
th[scope="col"]I guess it should.. It's not super explicit. Wonder what most the software does on this front.
I tested:
<th>is cell indeed, when usingscope=color<thead>, the default role becomes columnheader<th>role when usingscope=color<thead>hartman commentedon Jun 29, 2017
And on that note. What about thead ?
<th>cells inside a<thead>should be reasonably safe to assume to be column headers right ?DavidMacDonald commentedon Jul 3, 2017
I think scope doesn't do that much these days, but its good to know that Safari changes the role to column header instead of the unhelpful
role="cell"We "could" say:
thwithscope="col"map torole="columnheader"thwithscope="row"map torole="rowheader"thinsidetheadmap torole="columnheader"I think we should do that, but that still requires the author to add the
scopeorthead.I think the addition a new
role="tableheader"will be the most elegant because it would allow the implicit mapping ofthto that role, and then the author could simply do<th aria-sort="ascending">hartman commentedon Jul 4, 2017
Also relevant: https://www.w3.org/TR/WCAG20-TECHS/H63.html
DavidMacDonald commentedon Jul 14, 2017
@hartman We wrote that technique about 15 years ago, in the early days of WCAG. Screen readers have largely overcome the need for scope except in limited situations.
jnurthen commentedon Sep 30, 2019
Looks like HTML-AAM was updated to map
thtocolumnheaderorrowheader- closing this