@@ -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 ) {
@@ -2898,11 +2896,14 @@ function defocusSearchBar() {
2898
2896
[ "T" , "Focus the theme picker menu" ] ,
2899
2897
[ "↑" , "Move up in search results" ] ,
2900
2898
[ "↓" , "Move down in search results" ] ,
2901
- [ "↹ " , "Switch tab" ] ,
2899
+ [ "ctrl + ↑ / ↓ " , "Switch result tab" ] ,
2902
2900
[ "⏎" , "Go to active search result" ] ,
2903
2901
[ "+" , "Expand all sections" ] ,
2904
2902
[ "-" , "Collapse all sections" ] ,
2905
- ] . map ( x => "<dt><kbd>" + x [ 0 ] + "</kbd></dt><dd>" + x [ 1 ] + "</dd>" ) . join ( "" ) ;
2903
+ ] . map ( x => "<dt>" +
2904
+ x [ 0 ] . split ( " " )
2905
+ . map ( ( y , index ) => ( index & 1 ) === 0 ? "<kbd>" + y + "</kbd>" : y )
2906
+ . join ( "" ) + "</dt><dd>" + x [ 1 ] + "</dd>" ) . join ( "" ) ;
2906
2907
var div_shortcuts = document . createElement ( "div" ) ;
2907
2908
addClass ( div_shortcuts , "shortcuts" ) ;
2908
2909
div_shortcuts . innerHTML = "<h2>Keyboard Shortcuts</h2><dl>" + shortcuts + "</dl></div>" ;
0 commit comments