File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 2
2
'use strict'
3
3
4
4
var FORWARD_BACK_TYPE = 2
5
- var CTRL_KEY_CODE = 17
6
- var LT_KEY_CODE = 188
7
- var S_KEY_CODE = 83
8
- var SOLIDUS_KEY_CODE = 191
9
5
var SEARCH_FILTER_ACTIVE_KEY = 'docs:search-filter-active'
10
6
var SAVED_SEARCH_STATE_KEY = 'docs:saved-search-state'
11
7
var SAVED_SEARCH_STATE_VERSION = '1'
144
140
145
141
function handleShortcuts ( e ) {
146
142
var target = e . target || { }
147
- if ( e . ctrlKey && e . keyCode === LT_KEY_CODE && target === this . $input [ 0 ] ) return restoreSearch . call ( this )
143
+ if ( e . ctrlKey && e . key === '<' && target === this . $input [ 0 ] ) return restoreSearch . call ( this )
148
144
if ( e . altKey || e . shiftKey || target . isContentEditable || 'disabled' in target ) return
149
- if ( e . ctrlKey ? e . keyCode === SOLIDUS_KEY_CODE : e . keyCode === S_KEY_CODE ) {
145
+ if ( e . ctrlKey ? e . key === '/' : e . key === 's' ) {
150
146
this . $input . focus ( )
151
147
e . preventDefault ( )
152
148
e . stopPropagation ( )
164
160
}
165
161
166
162
function onCtrlKeyDown ( e ) {
167
- if ( e . keyCode !== CTRL_KEY_CODE ) return
163
+ if ( e . key !== 'Control' ) return
168
164
this . ctrlKeyDown = true
169
165
var container = getScrollableResultsContainer ( this . dropdown )
170
166
var prevScrollTop = container . scrollTop ( )
173
169
}
174
170
175
171
function onCtrlKeyUp ( e ) {
176
- if ( e . keyCode !== CTRL_KEY_CODE ) return
172
+ if ( e . key !== 'Control' ) return
177
173
delete this . ctrlKeyDown
178
174
this . $input . focus ( )
179
175
}
You can’t perform that action at this time.
0 commit comments