tabindex declared on hidden header cells
tabindex declared on hidden header cells

On a sortable and scrollable table, the header is duplicated (but hidden) within the scrollBody part, with tabindex attribute set to 0 (tabindex=0).
As a result, when using only a keyboard the focus seems to be "lost" after the last cell of the visible header, since the hidden header cells get the focus.
workaround : set tabindex to -1 on hidden header cells
$('.dataTables_scrollBody thead th').each(function () { $(this).attr('tabindex', -1); });
As a result, when using only a keyboard the focus seems to be "lost" after the last cell of the visible header, since the hidden header cells get the focus.
workaround : set tabindex to -1 on hidden header cells
$('.dataTables_scrollBody thead th').each(function () { $(this).attr('tabindex', -1); });
This discussion has been closed.
Replies
since the hidden header is recreated each time the grid is filtered (re-drawn), the tab index must be reset using fnDrawCallback
"fnDrawCallback": function( oSettings ) {
$('.dataTables_scrollBody thead th').each(function () {
$(this).attr('tabindex', -1);
});
}
Regards,
Allan