Mottie / tablesorter

Github fork of Christian Bach's tablesorter plugin + awesomeness ~
https://mottie.github.io/tablesorter/docs/
2.61k stars 754 forks source link

Accessibility: sorting functionality needs to be done via buttons #1688

Open jechols opened 5 years ago

jechols commented 5 years ago

There are some accessibility problems with the sortable headers generated:

If a semantic <button> isn't doable / desirable, an element must be built that functions as a button and declares itself to be a button via the "button" role. It must respond to clicks, the "enter" key, and the space bar; it must be in the tab order; etc. A button achieves all this without any custom JavaScript, but it's not required. The W3C's reference implementation uses a span that's coded to act as a button: http://w3c.github.io/aria-practices/examples/grid/dataGrids.html#ex2_label. (Their example is for a table coded as a data grid, so certain things may not apply directly to a simpler table, but W3C's examples tend to be excellent for reference compared to looking up stuff on a random blog.)

Mottie commented 5 years ago

Hi @jechols!

Thanks for sharing the link and information. You're right, I haven't been keeping this library up to date with the accessibility standards. I think updating would require some substantial internal changes which would warrant a major release. Sadly, I haven't found the time to complete my already planned rewrite. But I will be sure to save these links and follow the current standard.

jechols commented 5 years ago

Thanks for the response, I definitely understand the difficulties in remediation on codebases that didn't start out with accessibility features as a core principle. I'll watch for your next update, and maybe poke around in the code, though if you think it's a huge change I doubt I can help :(