@@ -1469,16 +1469,21 @@ function defocusSearchBar() {
1469
1469
} ) ;
1470
1470
1471
1471
if ( e . which === 38 ) { // up
1472
- if ( ! actives [ currentTab ] . length ||
1473
- ! actives [ currentTab ] [ 0 ] . previousElementSibling ) {
1474
- return ;
1472
+ if ( e . ctrlKey ) { // Going through result tabs.
1473
+ printTab ( currentTab > 0 ? currentTab - 1 : 2 ) ;
1474
+ } else {
1475
+ if ( ! actives [ currentTab ] . length ||
1476
+ ! actives [ currentTab ] [ 0 ] . previousElementSibling ) {
1477
+ return ;
1478
+ }
1479
+ addClass ( actives [ currentTab ] [ 0 ] . previousElementSibling , "highlighted" ) ;
1480
+ removeClass ( actives [ currentTab ] [ 0 ] , "highlighted" ) ;
1475
1481
}
1476
-
1477
- addClass ( actives [ currentTab ] [ 0 ] . previousElementSibling , "highlighted" ) ;
1478
- removeClass ( actives [ currentTab ] [ 0 ] , "highlighted" ) ;
1479
1482
e . preventDefault ( ) ;
1480
1483
} else if ( e . which === 40 ) { // down
1481
- if ( ! actives [ currentTab ] . length ) {
1484
+ if ( e . ctrlKey ) { // Going through result tabs.
1485
+ printTab ( currentTab > 1 ? 0 : currentTab + 1 ) ;
1486
+ } else if ( ! actives [ currentTab ] . length ) {
1482
1487
var results = document . getElementById ( "results" ) . childNodes ;
1483
1488
if ( results . length > 0 ) {
1484
1489
var res = results [ currentTab ] . getElementsByClassName ( "result" ) ;
@@ -1496,13 +1501,6 @@ function defocusSearchBar() {
1496
1501
document . location . href =
1497
1502
actives [ currentTab ] [ 0 ] . getElementsByTagName ( "a" ) [ 0 ] . href ;
1498
1503
}
1499
- } else if ( e . which === 9 ) { // tab
1500
- if ( e . shiftKey ) {
1501
- printTab ( currentTab > 0 ? currentTab - 1 : 2 ) ;
1502
- } else {
1503
- printTab ( currentTab > 1 ? 0 : currentTab + 1 ) ;
1504
- }
1505
- e . preventDefault ( ) ;
1506
1504
} else if ( e . which === 16 ) { // shift
1507
1505
// Does nothing, it's just to avoid losing "focus" on the highlighted element.
1508
1506
} else if ( actives [ currentTab ] . length > 0 ) {
@@ -2879,11 +2877,14 @@ function defocusSearchBar() {
2879
2877
[ "T" , "Focus the theme picker menu" ] ,
2880
2878
[ "↑" , "Move up in search results" ] ,
2881
2879
[ "↓" , "Move down in search results" ] ,
2882
- [ "↹ " , "Switch tab" ] ,
2880
+ [ "ctrl + ↑ / ↓ " , "Switch result tab" ] ,
2883
2881
[ "⏎" , "Go to active search result" ] ,
2884
2882
[ "+" , "Expand all sections" ] ,
2885
2883
[ "-" , "Collapse all sections" ] ,
2886
- ] . map ( x => "<dt><kbd>" + x [ 0 ] + "</kbd></dt><dd>" + x [ 1 ] + "</dd>" ) . join ( "" ) ;
2884
+ ] . map ( x => "<dt>" +
2885
+ x [ 0 ] . split ( " " )
2886
+ . map ( ( y , index ) => ( index & 1 ) === 0 ? "<kbd>" + y + "</kbd>" : y )
2887
+ . join ( "" ) + "</dt><dd>" + x [ 1 ] + "</dd>" ) . join ( "" ) ;
2887
2888
var div_shortcuts = document . createElement ( "div" ) ;
2888
2889
addClass ( div_shortcuts , "shortcuts" ) ;
2889
2890
div_shortcuts . innerHTML = "<h2>Keyboard Shortcuts</h2><dl>" + shortcuts + "</dl></div>" ;
0 commit comments