File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 83
83
flex : auto;
84
84
}
85
85
86
- # search . query : focus {
86
+ # search : focus {
87
87
outline : none;
88
88
}
89
89
Original file line number Diff line number Diff line change 3
3
4
4
activateSearch ( require ( 'docsearch.js/dist/cdn/docsearch.js' ) , document . getElementById ( 'search-script' ) . dataset )
5
5
6
+ var CTRL_KEY = 17
6
7
var S_KEY = 83
7
8
var SOLIDUS_KEY = 191
8
9
39
40
input . on ( 'autocomplete:updated' , resetScroll . bind ( autocomplete . getWrapper ( ) . firstChild ) )
40
41
typeahead . dropdown . _ensureVisible = ensureVisible
41
42
if ( filterInput ) filterInput . addEventListener ( 'change' , toggleFilter . bind ( typeahead ) )
43
+ monitorCtrlKey ( input , typeahead . dropdown . $menu )
42
44
searchField . addEventListener ( 'click' , confineEvent )
43
45
document . documentElement . addEventListener ( 'click' , resetSearch . bind ( autocomplete ) )
44
46
document . addEventListener ( 'keydown' , handleShortcuts . bind ( input ) )
98
100
}
99
101
}
100
102
103
+ function monitorCtrlKey ( input , dropdown ) {
104
+ input . on ( 'keydown' , onCtrlKeyDown . bind ( dropdown ) )
105
+ dropdown . on ( 'keyup' , onCtrlKeyUp . bind ( input ) )
106
+ }
107
+
108
+ function onCtrlKeyDown ( e ) {
109
+ if ( e . keyCode === CTRL_KEY ) this . find ( '.ds-cursor a' ) . focus ( )
110
+ }
111
+
112
+ function onCtrlKeyUp ( e ) {
113
+ if ( e . keyCode === CTRL_KEY ) this . focus ( )
114
+ }
115
+
101
116
function resetSearch ( ) {
102
117
this . close ( )
103
118
this . setVal ( )
You can’t perform that action at this time.
0 commit comments