From 2dfe4f9d7af720c4360e2e2ec760612763e52084 Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Tue, 24 Mar 2026 17:47:16 -0400 Subject: [PATCH] fix: focus terminal on mount so keyboard input works immediately The watch on isActive never fired on initial mount because the value starts as true (Vue watch only triggers on changes). Added explicit focus + fit in onMounted with a short delay for DOM readiness. Also added @click handler on container as fallback focus mechanism. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/terminal/TerminalView.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/terminal/TerminalView.vue b/src/components/terminal/TerminalView.vue index c3a2ebd..56e9130 100644 --- a/src/components/terminal/TerminalView.vue +++ b/src/components/terminal/TerminalView.vue @@ -49,6 +49,7 @@
@@ -136,9 +137,15 @@ onMounted(() => { terminal.onResize(({ cols, rows }) => { sessionStore.setTerminalDimensions(props.sessionId, cols, rows); }); + + // Focus the terminal after mount so keyboard input works immediately + setTimeout(() => { + fit(); + terminal.focus(); + }, 50); }); -// Re-fit and focus terminal when this tab becomes active +// Re-fit and focus terminal when switching back to this tab watch( () => props.isActive, (active) => {