Skip to content

Commit

Permalink
fix: guard search hotkey when an input is focused
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman committed Apr 9, 2019
1 parent 714c153 commit 116ba91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addon/components/docs-header/search-box/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { on } from '@ember/object/evented';
import { task } from 'ember-concurrency';
import config from 'dummy/config/environment';
import { inject as service } from '@ember/service';
import { formElementHasFocus } from 'ember-cli-addon-docs/keyboard-config';

const projectName = config['ember-cli-addon-docs'].projectName;

Expand Down Expand Up @@ -33,7 +34,9 @@ export default Component.extend(EKMixin, {
}),

focusSearch: on(keyUp('Slash'), function() {
this.element.querySelector('input').focus();
if (!formElementHasFocus()) {
this.element.querySelector('input').focus();
}
}),

unfocusSearch: on(keyUp('Escape'), function() {
Expand Down

0 comments on commit 116ba91

Please sign in to comment.