Skip to content

Commit

Permalink
Prevent search shortcut from breaking other input elements
Browse files Browse the repository at this point in the history
  • Loading branch information
m-allanson committed Jan 30, 2018
1 parent a98211c commit f429b70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion www/src/components/search-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ class SearchForm extends Component {

focusSearchInput(e) {
if (e.key !== `s`) return
if (document.activeElement === this.searchInput) return // eslint-disable-line no-undef

// ignore this shortcut whenever an <input> has focus
if (document.activeElement instanceof window.HTMLInputElement) return // eslint-disable-line no-undef

e.preventDefault()
this.searchInput.focus()
}
Expand Down

0 comments on commit f429b70

Please sign in to comment.