focus and scroll to input only when it's needed
This commit is contained in:
parent
fe8eb76928
commit
9132814ccf
@ -79,8 +79,12 @@ class DisplaySearch extends Display {
|
||||
|
||||
onSearchInput() {
|
||||
this.updateSearchButton();
|
||||
|
||||
const queryElementRect = this.query.getBoundingClientRect();
|
||||
if (queryElementRect.top < 0 || queryElementRect.bottom > window.innerHeight) {
|
||||
this.query.scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
onSearch(e) {
|
||||
if (this.query === null) {
|
||||
@ -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});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user