diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index 7fbc658718..96dd37a5c0 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -95,6 +95,7 @@ export const ChatTextArea = forwardRef( commands, cloudUserInfo, enterBehavior, + experiments, } = useExtensionState() // Find the ID and display text for the currently selected API configuration. @@ -1080,7 +1081,7 @@ export const ChatTextArea = forwardRef( placeholder={placeholderText} minRows={3} maxRows={15} - autoFocus={true} + autoFocus={!experiments?.preventFocusDisruption} className={cn( "w-full", "text-vscode-input-foreground", diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 6f3ee16ec1..40b470598a 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -96,6 +96,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction { - if (!isHidden && !sendingDisabled && !enableButtons) { + if (!isHidden && !sendingDisabled && !enableButtons && !experiments?.preventFocusDisruption) { textAreaRef.current?.focus() } }, 50, - [isHidden, sendingDisabled, enableButtons], + [isHidden, sendingDisabled, enableButtons, experiments?.preventFocusDisruption], ) useEffect(() => {