Column sort aria labels not updating for multi-column sort

Column sort aria labels not updating for multi-column sort

KuronumaKuronuma Posts: 7Questions: 3Answers: 0

Hello! I really appreciate the ability to customize the aria labels for the column sort functionality. :)

However, I did notice that when using multi-column sort, the aria labels do not update when the sort order changes for any column other than the 1st column. I noticed this occurs with both the default aria labels and with custom labels. Does anyone have a solution for this?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    This is expected. The ARIA spec says that aria-sort should be applied to a single table header cell only.

    This Gthub issue for ARIA discusses changing that (I've already added a comment there and subscribed to that thread). As soon as the spec is updated, I'll be updated DataTables for it.

    Allan

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Sorry - I've just reread your post, and I've got the wrong end of the stick... You are talking about aria-label, not aria-sort. I agree - there is a bug there that needs to be looked at. Thanks for raising it.

    Allan

  • KuronumaKuronuma Posts: 7Questions: 3Answers: 0

    Thanks! :)

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I've been thinking about this and the multi-column sorting is a nuance that my aria-label logic and strings do not currently handle. It is a second order effect.

    For example, the default text "Activate to sort" is correct - click on that column and it will order the table by that column.

    What the text doesn't inform about is what happens if you shift click on a column header.

    It could be that the text should be "Activate to sort, or shift click to modify multi-column sort". That can be added using the language string options at the moment.

    Changing the aria-label to be completely based off the multi-column sort I think would be wrong (particularly given that aria-sort has single column support only).

    The up shot - I don't propose to make any changes in DataTables at the moment. If you need the aria-label to mention multi-column sorting you can update the text using language.aria.orderable and friends.

    Allan

  • KuronumaKuronuma Posts: 7Questions: 3Answers: 0

    That's fair! I like your suggestion. I'll implement something like that.

Sign In or Register to comment.