Skip to content

Commit

Permalink
impr(commandline): scroll active entry into view when searchbar is em…
Browse files Browse the repository at this point in the history
…pty (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
  • Loading branch information
JayTailor45 committed Oct 2, 2023
1 parent 6096b0c commit d2a6b89
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion frontend/src/ts/commandline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d2a6b89

Please sign in to comment.