From 1df83325e4f02ef08abd704460f963faf4b98d86 Mon Sep 17 00:00:00 2001 From: OpeOginni Date: Sun, 4 Jan 2026 02:58:45 +0100 Subject: [PATCH] feat(desktop): implement auto-scroll for active command in slash popover --- packages/app/src/components/prompt-input.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/app/src/components/prompt-input.tsx b/packages/app/src/components/prompt-input.tsx index 9657507ffb3..7141b1c9d0d 100644 --- a/packages/app/src/components/prompt-input.tsx +++ b/packages/app/src/components/prompt-input.tsx @@ -106,6 +106,7 @@ export const PromptInput: Component = (props) => { let editorRef!: HTMLDivElement let fileInputRef!: HTMLInputElement let scrollRef!: HTMLDivElement + let slashPopoverRef!: HTMLDivElement const scrollCursorIntoView = () => { const container = scrollRef @@ -448,6 +449,17 @@ export const PromptInput: Component = (props) => { onSelect: handleSlashSelect, }) + // Auto-scroll active command into view when navigating with keyboard + createEffect(() => { + const activeId = slashActive() + if (!activeId || !slashPopoverRef) return + + requestAnimationFrame(() => { + const element = slashPopoverRef.querySelector(`[data-slash-id="${activeId}"]`) + element?.scrollIntoView({ block: "nearest", behavior: "smooth" }) + }) + }) + createEffect( on( () => prompt.current(), @@ -1452,6 +1464,9 @@ export const PromptInput: Component = (props) => {
{ + if (store.popover === "slash") slashPopoverRef = el + }} class="absolute inset-x-0 -top-3 -translate-y-full origin-bottom-left max-h-80 min-h-10 overflow-auto no-scrollbar flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md" @@ -1510,6 +1525,7 @@ export const PromptInput: Component = (props) => { {(cmd) => (