@@ -238,7 +238,6 @@ class SearchForm extends Component {
238238 super ( )
239239 this . state = { enabled : true , focussed : false }
240240 this . autocompleteSelected = this . autocompleteSelected . bind ( this )
241- this . focusSearchInput = this . focusSearchInput . bind ( this )
242241 }
243242
244243 /**
@@ -257,16 +256,6 @@ class SearchForm extends Component {
257256 navigateTo ( `${ a . pathname } ${ a . hash } ` )
258257 }
259258
260- focusSearchInput ( e ) {
261- if ( e . key !== `s` ) return
262-
263- // ignore this shortcut whenever an <input> has focus
264- if ( document . activeElement instanceof window . HTMLInputElement ) return // eslint-disable-line no-undef
265-
266- e . preventDefault ( )
267- this . searchInput . focus ( )
268- }
269-
270259 componentDidMount ( ) {
271260 if (
272261 typeof window === `undefined` || // eslint-disable-line no-undef
@@ -277,9 +266,6 @@ class SearchForm extends Component {
277266 return
278267 }
279268
280- // eslint-disable-next-line no-undef
281- window . addEventListener ( `keydown` , this . focusSearchInput )
282-
283269 // eslint-disable-next-line no-undef
284270 window . addEventListener (
285271 `autocomplete:selected` ,
@@ -297,15 +283,11 @@ class SearchForm extends Component {
297283 openOnFocus : true ,
298284 autoselect : true ,
299285 hint : false ,
286+ keyboardShortcuts : [ 's' ]
300287 } ,
301288 } )
302289 }
303290
304- componentWillUnmount ( ) {
305- // eslint-disable-next-line no-undef
306- window . removeEventListener ( `keydown` , this . focusSearchInput )
307- }
308-
309291 render ( ) {
310292 const { enabled, focussed } = this . state
311293 const { iconStyles, isHomepage } = this . props
0 commit comments