impr(commandline): scroll active entry into view when searchbar is empty (JayTailor45) (#4663)

* fix: language selection scroll into view behaviour

* impr: improve animation logic

* impr: display selected language to center

* impr: add background hover for selected language

* impr: reuse existing keepActiveEntryInView function
This commit is contained in:
JAY TAILOR 2023-10-02 20:01:50 +05:30 committed by GitHub
parent 6096b0cde1
commit d2a6b896ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -218,8 +218,18 @@ function updateSuggested(): void {
});
}
showFound();
activeIndex = 0;
// display background hover effect for selected language
const scrollTarget = $(".suggestions .entry .icon i.fa-check");
const entryIndex = scrollTarget.parent().parent().attr("index");
if (entryIndex !== undefined) {
activeIndex = parseInt(entryIndex);
} else {
activeIndex = 0;
}
updateActiveEntry();
keepActiveEntryInView();
}
function show(): void {