File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ <h3>{{ _('Navigation') }}</h3>
48
48
{%- if builder != "htmlhelp" %}
49
49
< div class ="inline-search " role ="search ">
50
50
< form class ="inline-search " action ="{{ pathto('search') }} " method ="get ">
51
- < input placeholder ="{{ _('Quick search') }} " aria-label ="{{ _('Quick search') }} " type ="search " name ="q " />
51
+ < input placeholder ="{{ _('Quick search') }} " aria-label ="{{ _('Quick search') }} " type ="search " name ="q " id =" search-box " />
52
52
< input type ="submit " value ="{{ _('Go') }} " />
53
53
</ form >
54
54
</ div >
@@ -76,6 +76,7 @@ <h3>{{ _('Navigation') }}</h3>
76
76
{%- if not embedded %}
77
77
< script type ="text/javascript " src ="{{ pathto('_static/copybutton.js', 1) }} "> </ script >
78
78
< script type ="text/javascript " src ="{{ pathto('_static/menu.js', 1) }} "> </ script >
79
+ < script type ="text/javascript " src ="{{ pathto('_static/search-focus.js', 1) }} "> </ script >
79
80
< script type ="text/javascript " src ="{{ pathto('_static/themetoggle.js', 1) }} "> </ script >
80
81
{%- endif -%}
81
82
{%- endif -%}
Original file line number Diff line number Diff line change
1
+ document . addEventListener ( 'keydown' , function ( event ) {
2
+ if ( event . key === '/' ) {
3
+ // Prevent "/" from being entered in the search box
4
+ event . preventDefault ( ) ;
5
+
6
+ // Set the focus on the search box
7
+ let searchBox = document . getElementById ( 'search-box' ) ;
8
+ searchBox . focus ( ) ;
9
+ }
10
+ } ) ;
You can’t perform that action at this time.
0 commit comments