diff --git a/www/src/components/search-form.js b/www/src/components/search-form.js index 5e166731ea825..8c59f4e3212fa 100644 --- a/www/src/components/search-form.js +++ b/www/src/components/search-form.js @@ -238,7 +238,6 @@ class SearchForm extends Component { super() this.state = { enabled: true, focussed: false } this.autocompleteSelected = this.autocompleteSelected.bind(this) - this.focusSearchInput = this.focusSearchInput.bind(this) } /** @@ -257,16 +256,6 @@ class SearchForm extends Component { navigateTo(`${a.pathname}${a.hash}`) } - focusSearchInput(e) { - if (e.key !== `s`) return - - // ignore this shortcut whenever an has focus - if (document.activeElement instanceof window.HTMLInputElement) return // eslint-disable-line no-undef - - e.preventDefault() - this.searchInput.focus() - } - componentDidMount() { if ( typeof window === `undefined` || // eslint-disable-line no-undef @@ -277,9 +266,6 @@ class SearchForm extends Component { return } - // eslint-disable-next-line no-undef - window.addEventListener(`keydown`, this.focusSearchInput) - // eslint-disable-next-line no-undef window.addEventListener( `autocomplete:selected`, @@ -297,15 +283,11 @@ class SearchForm extends Component { openOnFocus: true, autoselect: true, hint: false, + keyboardShortcuts: ['s'] }, }) } - componentWillUnmount() { - // eslint-disable-next-line no-undef - window.removeEventListener(`keydown`, this.focusSearchInput) - } - render() { const { enabled, focussed } = this.state const { iconStyles, isHomepage } = this.props