From 0a1664ba296796c347a1690ff5eea71363961806 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 15 Jan 2021 20:19:56 -0500 Subject: Separate close hotkey (#1242) * Add focusSearchBox hotkey * Update close hotkey action * Update hotkeys --- ext/bg/js/search.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'ext/bg/js/search.js') diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 340b86ce..00148418 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -43,6 +43,10 @@ class DisplaySearch extends Display { } }); this.autoPlayAudioDelay = 0; + + this.registerActions([ + ['focusSearchBox', this._onActionFocusSearchBox.bind(this)] + ]); } async prepare() { @@ -77,15 +81,6 @@ class DisplaySearch extends Display { this._isPrepared = true; } - onEscape() { - if (this._queryInput === null) { - return; - } - - this._queryInput.focus(); - this._queryInput.select(); - } - onKeyDown(e) { if ( !super.onKeyDown(e) && @@ -110,6 +105,14 @@ class DisplaySearch extends Display { return query; } + // Actions + + _onActionFocusSearchBox() { + if (this._queryInput === null) { return; } + this._queryInput.focus(); + this._queryInput.select(); + } + // Private async _onOptionsUpdated() { -- cgit v1.2.3