Skip to content

The VS Code of video editing, built for agents.

TypeScript

Add focus behavior to PromptInput component on mount

konstantin-paulus6f14ce551a60
diff --git a/apps/web/src/components/genai/prompt-input.tsx b/apps/web/src/components/genai/prompt-input.tsx
index a90e63c5..a299df60 100644
--- a/apps/web/src/components/genai/prompt-input.tsx
+++ b/apps/web/src/components/genai/prompt-input.tsx
@@ -26,6 +26,7 @@ import {
createMemo,
createSignal,
onCleanup,
+ onMount,
type Accessor,
} from "solid-js";
@@ -299,6 +300,11 @@ export function PromptInput(props: PromptInputProps) {
textareaRef.style.height = `${textareaRef.scrollHeight}px`;
};
+ onMount(() => {
+ textareaRef.focus();
+ textareaRef.setSelectionRange(textareaRef.value.length, textareaRef.value.length);
+ });
+
const handleSelectRecentPrompt = (prompt: string) => {
patch({ prompt });
setSlashMenuDismissed(true);