aria-sort attribute probably not correctly used

aria-sort attribute probably not correctly used

sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0
edited November 2023 in Free community support

We have established multi-column sorting in our table. Aria is considered important.
When a column is sorted only the first sorted column gets the 'aria-sort' option set, which is not what we would expect.

In the code I found:
/* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */

This statement I could not agree with because neither in the spec, nor mdn there is anything written about it. Could it be that the code follows an outdated spec or is there any reallife-derived experience that led to this assumption?

https://w3c.github.io/aria/#aria-sort
https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaSort

Thank you and have a great day!

Answers

  • allanallan Posts: 63,451Questions: 1Answers: 10,465 Site admin

    Hi,

    Thanks for bringing this up. The spec for aria-sort says:

    For each table or grid, authors SHOULD apply aria-sort to only one header at a time.

    I took that to mean that only one column header should after the aria-sort attribute, which is why it is implemented in that way.

    The commit that introduced that comment was based off this discussion - it doesn't explicitly talk about the single aria-sort attribute in that thread though.

    I think it is implemented correctly per the ARIA spec at the moment. Or is your reading of it different?

    Allan

  • sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0

    Oh, sorry. I didn't read well enough. My bad!

    Anyway, there seems to be some movement:
    https://github.com/w3c/aria/issues/283

  • sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0

    In addition to this, it is only a SHOULD, not a MUST as in other places of the spec.

  • allanallan Posts: 63,451Questions: 1Answers: 10,465 Site admin

    Slow movement perhaps :). That issue was opened in 2016, so I wouldn't expect a quick resolution to this I'm afraid.

    I've subscriped to that thread though, so if there is a decision on how it should be implemented, I can get it into DataTables. Until then, I think I should stick to the published spec.

    Allan

Sign In or Register to comment.