aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/search.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index d74998d6..1a6822f6 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -79,7 +79,11 @@ class DisplaySearch extends Display {
onSearchInput() {
this.updateSearchButton();
- this.query.scrollIntoView();
+
+ const queryElementRect = this.query.getBoundingClientRect();
+ if (queryElementRect.top < 0 || queryElementRect.bottom > window.innerHeight) {
+ this.query.scrollIntoView();
+ }
}
onSearch(e) {
@@ -123,7 +127,7 @@ class DisplaySearch extends Display {
}
}
- if (!super.onKeyDown(e) && !preventFocus) {
+ if (!super.onKeyDown(e) && !preventFocus && document.activeElement !== this.query) {
this.query.focus({preventScroll: true});
}
}