diff --git a/packages/ui/src/components/tool-call/question-block.tsx b/packages/ui/src/components/tool-call/question-block.tsx index eb7c00c1..7e273fac 100644 --- a/packages/ui/src/components/tool-call/question-block.tsx +++ b/packages/ui/src/components/tool-call/question-block.tsx @@ -1,4 +1,4 @@ -import { createMemo, Show, For, type Accessor } from "solid-js" +import { createMemo, Show, For, createEffect, type Accessor } from "solid-js" import type { ToolState } from "@opencode-ai/sdk" import type { QuestionRequest } from "@opencode-ai/sdk/v2" import { useI18n } from "../../lib/i18n" @@ -28,6 +28,13 @@ export type QuestionToolBlockProps = { export function QuestionToolBlock(props: QuestionToolBlockProps) { const { t } = useI18n() + let firstInputRef: HTMLInputElement | undefined + + createEffect(() => { + if (props.active() && firstInputRef) { + firstInputRef.focus() + } + }) const requestId = createMemo(() => { const state = props.toolState() @@ -206,7 +213,7 @@ export function QuestionToolBlock(props: QuestionToolBlockProps) {
- {(opt) => { + {(opt, optIndex) => { const checked = () => selected().includes(opt.label) return (