Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aria-sort forces role="columnheader" or rowheader Validation throws error on <th> #592

Closed
DavidMacDonald opened this issue Jun 26, 2017 · 6 comments

Comments

@DavidMacDonald
Copy link

DavidMacDonald commented Jun 26, 2017

The wayaria-sort it is written, it is invalid HTML to rely on the <th> like this:

<th aria-sort="acsending">

There is a thread here:

w3c/html#909

@stevefaulkner
@sideshowbarker

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.

@hartman
Copy link

hartman commented 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:

  • Safari: default of <th> is cell indeed, when using scope=col or <thead>, the default role becomes columnheader
  • Chrome: Does not change the <th> role when using scope=col or <thead>

@hartman
Copy link

hartman commented 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
Copy link
Author

DavidMacDonald commented 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:

  • 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
Copy link

hartman commented Jul 4, 2017

Also relevant: https://www.w3.org/TR/WCAG20-TECHS/H63.html

@DavidMacDonald
Copy link
Author

DavidMacDonald commented 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
Copy link
Member

Looks like HTML-AAM was updated to map th to columnheader or rowheader - closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants