Skip to content

Commit 06df529

Browse files
authored
fix(theme): scroll theme list to active theme on open (@abulKhasim) (#7774)
When opening the theme selector, the list always starts at the top regardless of the currently active theme. This means users have to manually scroll to find their current theme before switching. This fix scrolls the theme list to the currently active theme when the selector is opened, so users immediately see their position in the list. Steps to reproduce: 1. Set any theme other than the first one (e.g. blueberry dark) 2. Open the theme selector 3. List starts from the top instead of the active theme
1 parent 83e90e1 commit 06df529

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

frontend/src/ts/commandline/commandline.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export function show(
172172
await showCommands();
173173
await updateActiveCommand();
174174
setTimeout(() => {
175+
lastActiveIndex = undefined;
175176
keepActiveCommandInView();
176177
if (showInputCommand) {
177178
const escaped =
@@ -488,6 +489,11 @@ async function showCommands(): Promise<void> {
488489

489490
for (const command of list) {
490491
if (command.found !== true) continue;
492+
493+
if (command.isActive && firstActive === null && inputValue === "") {
494+
firstActive = index;
495+
}
496+
491497
let customStyle = "";
492498
if (command.customStyle !== undefined && command.customStyle !== "") {
493499
customStyle = command.customStyle;

0 commit comments

Comments
 (0)