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 22 'use strict'
33
44 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
95 var SEARCH_FILTER_ACTIVE_KEY = 'docs:search-filter-active'
106 var SAVED_SEARCH_STATE_KEY = 'docs:saved-search-state'
117 var SAVED_SEARCH_STATE_VERSION = '1'
144140
145141 function handleShortcuts ( e ) {
146142 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 )
148144 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' ) {
150146 this . $input . focus ( )
151147 e . preventDefault ( )
152148 e . stopPropagation ( )
164160 }
165161
166162 function onCtrlKeyDown ( e ) {
167- if ( e . keyCode !== CTRL_KEY_CODE ) return
163+ if ( e . key !== 'Control' ) return
168164 this . ctrlKeyDown = true
169165 var container = getScrollableResultsContainer ( this . dropdown )
170166 var prevScrollTop = container . scrollTop ( )
173169 }
174170
175171 function onCtrlKeyUp ( e ) {
176- if ( e . keyCode !== CTRL_KEY_CODE ) return
172+ if ( e . key !== 'Control' ) return
177173 delete this . ctrlKeyDown
178174 this . $input . focus ( )
179175 }
You can’t perform that action at this time.
0 commit comments