Skip to content

Commit

Permalink
[www] Prevent search shortcut from breaking other input elements (#3777)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-allanson authored and fk committed Jan 30, 2018
1 parent a98211c commit 42cdfba
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 42cdfba

Please sign in to comment.