Skip to content

The VS Code of video editing, built for agents.

TypeScript

feat: implement focus handling for the composer on chat tab activation

konstantin-paulusc413432d75d6
diff --git a/apps/web/src/agent-chat/composer.tsx b/apps/web/src/agent-chat/composer.tsx
index e50d1280..31716d6e 100644
--- a/apps/web/src/agent-chat/composer.tsx
+++ b/apps/web/src/agent-chat/composer.tsx
@@ -55,6 +55,16 @@ export function Composer(props: ComposerProps) {
resize();
});
+ // The panel mounts whenever the Chat tab comes up: land in the box, ready
+ // to type. It may still be disabled while the host connects, and a disabled
+ // box can't take focus — so focus it the first time it is enabled.
+ let focused = false;
+ createEffect(() => {
+ if (focused || props.blocked !== null) return;
+ focused = true;
+ textarea?.focus();
+ });
+
// Enter sends, shift+enter breaks the line — and the editor's shortcuts
// have no business reading what is typed here. While a turn runs Enter
// does nothing: there is no queue.