From: jenkins-bot Date: Tue, 23 Jul 2013 13:21:58 +0000 (+0000) Subject: Merge "tablesorter: Keyboard accessibility for sort headers." X-Git-Tag: 1.31.0-rc.0~19141 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=aaa0645cf60ef8b83dd7d4f431eea4b247de8dae;p=lhc%2Fweb%2Fwiklou.git Merge "tablesorter: Keyboard accessibility for sort headers." --- aaa0645cf60ef8b83dd7d4f431eea4b247de8dae diff --cc resources/jquery/jquery.tablesorter.js index d20d280dbd,a231f26fa7..863d8ec72e --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@@ -741,12 -734,33 +744,17 @@@ table.config.parsers = buildParserCache( table, $headers ); } - // as each header can span over multiple columns (using colspan=N), - // we have to bidirectionally map headers to their columns and columns to their headers - headerToColumns = []; - columnToHeader = []; - colspanOffset = 0; - $headers.each( function ( headerIndex ) { - var columns = []; - for ( var i = 0; i < this.colSpan; i++ ) { - columnToHeader[ colspanOffset + i ] = headerIndex; - columns.push( colspanOffset + i ); - } - - headerToColumns[ headerIndex ] = columns; - colspanOffset += this.colSpan; - } ); - // 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; }