tabindex declared on hidden header cells

tabindex declared on hidden header cells

agkaagka Posts: 3Questions: 0Answers: 0
edited March 2013 in Bug reports
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); });

Replies

  • agkaagka Posts: 3Questions: 0Answers: 0
    update :
    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);
    });
    }
  • allanallan Posts: 61,665Questions: 1Answers: 10,095 Site admin
    Excellent point - thanks for flagging this up! Fix committed to git and it will be available in the next release (1.10): https://github.com/DataTables/DataTables/commit/079a1f2e1d

    Regards,
    Allan
This discussion has been closed.