Merge "tablesorter: Keyboard accessibility for sort headers."
This commit is contained in:
commit
aaa0645cf6
1 changed files with 13 additions and 5 deletions
|
|
@ -343,7 +343,10 @@
|
|||
}
|
||||
|
||||
if ( !this.sortDisabled ) {
|
||||
$( this ).addClass( table.config.cssHeader ).attr( 'title', msg[1] );
|
||||
$( this )
|
||||
.addClass( table.config.cssHeader )
|
||||
.attr( 'title', msg[1] )
|
||||
.prop( 'tabIndex', 0 ).attr( 'role', 'button' );
|
||||
}
|
||||
|
||||
// add cell to headerList
|
||||
|
|
@ -743,10 +746,15 @@
|
|||
|
||||
// Apply event handling to headers
|
||||
// this is too big, perhaps break it out?
|
||||
$headers.filter( ':not(.unsortable)' ).click( function ( e ) {
|
||||
if ( e.target.nodeName.toLowerCase() === 'a' ) {
|
||||
// The user clicked on a link inside a table header
|
||||
// Do nothing and let the default link click action continue
|
||||
$headers.filter( ':not(.unsortable)' ).on( 'keypress click', function ( e ) {
|
||||
if ( e.type === 'click' && e.target.nodeName.toLowerCase() === 'a' ) {
|
||||
// The user clicked on a link inside a table header.
|
||||
// Do nothing and let the default link click action continue.
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( e.type === 'keypress' && e.which !== 13 ) {
|
||||
// Only handle keypresses on the "Enter" key.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue