Skip to content

Commit

Permalink
4bc2118f2747e82d9509d4da4db0058b02230870 Update: Moved the tab focus …
Browse files Browse the repository at this point in the history
…(for keyboard access to ordering) to the ordering icon, rather than the full header cells. This makes a lot more sense as it acts as a button to trigger ordering, and it addresses a spec violation error which dictates that you cannot have `aria-sort` and `tabindex` on the same elements.

DD-3008
https://datatables.net/forums/discussion/79934

Sync to source repo @4bc2118f2747e82d9509d4da4db0058b02230870
  • Loading branch information
dtbuild committed Jan 4, 2025
1 parent 36d4c8c commit 6caeb6b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion datatables.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
],
"src-repo": "http://github.com/DataTables/DataTablesSrc",
"last-tag": "2.1.8",
"last-sync": "15a28f0db351b32b446a20ab2d4accd6acbd9716"
"last-sync": "4bc2118f2747e82d9509d4da4db0058b02230870"
}
6 changes: 4 additions & 2 deletions js/dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -13044,10 +13044,12 @@

// Make the headers tab-able for keyboard navigation
if (orderable) {
cell.find('.dt-column-title').attr('role', 'button');
var orderSpan = cell.find('.dt-column-order');

orderSpan.attr('role', 'button');

if (tabIndex !== -1) {
cell.attr('tabindex', 0);
orderSpan.attr('tabindex', tabIndex);
}
}
} );
Expand Down
2 changes: 1 addition & 1 deletion js/dataTables.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dataTables.min.mjs

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions js/dataTables.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12991,10 +12991,12 @@ $.extend( true, DataTable.ext.renderer, {

// Make the headers tab-able for keyboard navigation
if (orderable) {
cell.find('.dt-column-title').attr('role', 'button');
var orderSpan = cell.find('.dt-column-order');

orderSpan.attr('role', 'button');

if (tabIndex !== -1) {
cell.attr('tabindex', 0);
orderSpan.attr('tabindex', tabIndex);
}
}
} );
Expand Down

0 comments on commit 6caeb6b

Please sign in to comment.