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 33 < div id ="search-field-wrapper ">
44 < input id ="search-field " role ="combobox " aria-label ="Search "
55 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 "
77 title ="Type to search, Up and Down to navigate, Enter to load ">
88 </ div >
99
Original file line number Diff line number Diff line change @@ -78,7 +78,20 @@ function hookSearch() {
7878 search . scrollIntoView = search . scrollInWindow ;
7979} ;
8080
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+
8193document . addEventListener ( 'DOMContentLoaded' , function ( ) {
8294 hookSourceViews ( ) ;
8395 hookSearch ( ) ;
96+ hookFocus ( ) ;
8497} ) ;
You can’t perform that action at this time.
0 commit comments