File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
lib/rdoc/generator/template/darkfish Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 3
3
< div id ="search-field-wrapper ">
4
4
< input id ="search-field " role ="combobox " aria-label ="Search "
5
5
aria-autocomplete ="list " aria-controls ="search-results "
6
- type ="text " name ="search " placeholder ="Search " spellcheck ="false "
6
+ type ="text " name ="search " placeholder ="Search (/) for a class, method, ... " spellcheck ="false "
7
7
title ="Type to search, Up and Down to navigate, Enter to load ">
8
8
</ div >
9
9
Original file line number Diff line number Diff line change @@ -78,7 +78,20 @@ function hookSearch() {
78
78
search . scrollIntoView = search . scrollInWindow ;
79
79
} ;
80
80
81
+ function hookFocus ( ) {
82
+ document . addEventListener ( "keydown" , ( event ) => {
83
+ if ( document . activeElement . tagName === 'INPUT' ) {
84
+ return ;
85
+ }
86
+ if ( event . key === "/" ) {
87
+ event . preventDefault ( ) ;
88
+ document . querySelector ( '#search-field' ) . focus ( ) ;
89
+ }
90
+ } ) ;
91
+ }
92
+
81
93
document . addEventListener ( 'DOMContentLoaded' , function ( ) {
82
94
hookSourceViews ( ) ;
83
95
hookSearch ( ) ;
96
+ hookFocus ( ) ;
84
97
} ) ;
You can’t perform that action at this time.
0 commit comments