aria-sort labels and orderFixed

aria-sort labels and orderFixed

chris.durhamchris.durham Posts: 12Questions: 4Answers: 0

We are using rowgroup on many of our table to present the data in a more logical manner for our users and we use this alongside orderFixed to ensure that it's consistent.

The column used for orderFixed is set to visible: false, however ordering is set to true for all other columns.

Visually it works perfectly, but our accessibility reviews are throwing alerts because we have no aria-sort attributes.

I can see from the datatables code that it only allows a single aria-sort label, so I'm 99% sure it's applying that to the non-visible column. Is there anyway to make DataTables ignore non-visible columns when making that determination (or optionally allowing multiple aria-sort labels.

I'm aware that MDN says that there "should" only be one and I can see that Allan was interested in supporting the aria-sortorder option, but is there anyway to either ignore the hidden columns from that count or allow multiple aria-sort's even if not 100% spec compliant?

This question has an accepted answers - jump to answer


  • allanallan Posts: 62,484Questions: 1Answers: 10,262 Site admin
    Answer ✓

    Currently no, but that is a very good point that I hadn't considered. It does make a lot of sense to have the aria-label on the first visible column from the current ordering state. I'm travelling this week, but I've made a note of that and will get it in for the upcoming 2.1 release.


  • chris.durhamchris.durham Posts: 12Questions: 4Answers: 0

    As a follow-up the orderFixed fields do highlight where the lack of multiple aria-sort attributes is an issue, as the user can sort on the other column, but will never get a spoken indication that they have done.

    There is an argument that orderFixed columns visible or not should never get a aria-sort entry, since the user can't influence the table with them, effectively they are not orderable.

    That potentially begs the question - should/could orderFixed columns actually be defined as not orderable, such that they don't get the aria-* labels relating to sorting at all..

  • allanallan Posts: 62,484Questions: 1Answers: 10,262 Site admin
    edited July 9

    Yes, that is certainly a consideration. I think I'd take the view that aria-order should be on the first column that is sorted (plus the condition that it is visible now), regardless of if it comes from orderFixed or user ordering. The reason being that I would expect aria-order to be on the primary sort column. So the first column (that is visible) that data is sorted on should get the label.

    I'm happy to be corrected any someone who is using assistive technology and would expect otherwise though!


  • allanallan Posts: 62,484Questions: 1Answers: 10,262 Site admin


    A little update on this to say that I've committed the change needed and it will be in the nightly build soon (and then 2.1 when it drops next week).


Sign In or Register to comment.