Skip to content
Snippets Groups Projects
Commit eb4c09fc authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #1342760 by Everett Zufelt: add aria-sort to table sort.

parent dd1cc680
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -134,6 +134,10 @@ function tablesort_header($cell, $header, $ts) {
if (is_array($cell) && isset($cell['field'])) {
$title = t('sort by @s', array('@s' => $cell['data']));
if ($cell['data'] == $ts['name']) {
// aria-sort is a WAI-ARIA property that indicates if items in a table
// or grid are sorted in ascending or descending order. See
// http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort
$cell['aria-sort'] = ($ts['sort'] == 'asc') ? 'ascending' : 'descending';
$ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc');
$cell['class'][] = 'active';
$image = theme('tablesort_indicator', array('style' => $ts['sort']));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment