From 0f054a7e65365f456a4b741b9a2101be119f2ba7 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 4 Aug 2025 21:52:46 +0000 Subject: [PATCH 1/2] feat: focus chat input when clicking plus button in extension menu - Added focusInput action after chatButtonClicked in plusButtonClicked handler - This ensures the text area in ChatView gets focused when users click the + button - Improves user experience by allowing immediate typing after creating new chat --- src/activate/registerCommands.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/activate/registerCommands.ts b/src/activate/registerCommands.ts index bd925b0e90..0716d4b22f 100644 --- a/src/activate/registerCommands.ts +++ b/src/activate/registerCommands.ts @@ -97,6 +97,11 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt await visibleProvider.removeClineFromStack() await visibleProvider.postStateToWebview() await visibleProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" }) + + // Focus the input after a short delay to ensure the view has switched + setTimeout(() => { + visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" }) + }, 100) }, mcpButtonClicked: () => { const visibleProvider = getVisibleProviderOrLog(outputChannel) From ebde2c2f915207440b95731cf736a6ae77a34b0f Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 6 Aug 2025 21:07:10 +0000 Subject: [PATCH 2/2] fix: replace unreliable setTimeout with sequential message passing - Removed setTimeout with hardcoded 100ms delay - Now sending focusInput action immediately after chatButtonClicked - This ensures proper sequencing without arbitrary timing delays - More reliable approach that doesn't depend on timing assumptions --- src/activate/registerCommands.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/activate/registerCommands.ts b/src/activate/registerCommands.ts index 0716d4b22f..d1c7a347c2 100644 --- a/src/activate/registerCommands.ts +++ b/src/activate/registerCommands.ts @@ -97,11 +97,9 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt await visibleProvider.removeClineFromStack() await visibleProvider.postStateToWebview() await visibleProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" }) - - // Focus the input after a short delay to ensure the view has switched - setTimeout(() => { - visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" }) - }, 100) + // Send focusInput action immediately after chatButtonClicked + // This ensures the focus happens after the view has switched + await visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" }) }, mcpButtonClicked: () => { const visibleProvider = getVisibleProviderOrLog(outputChannel)