diff --git a/.changeset/mighty-pillows-pretend.md b/.changeset/mighty-pillows-pretend.md new file mode 100644 index 00000000..e3f0bdd0 --- /dev/null +++ b/.changeset/mighty-pillows-pretend.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Clear the chat input when the user changes mode within a task diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index 78f377ed..7fe9a345 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -81,6 +81,7 @@ interface ChatTextAreaProps { shouldDisableFilesAndImages: boolean onHeightChange?: (height: number) => void onFocusChange?: (isFocused: boolean) => void + isTaskView: boolean } interface GitCommit { @@ -268,6 +269,7 @@ const ChatTextArea = forwardRef( shouldDisableFilesAndImages, onHeightChange, onFocusChange, + isTaskView, }, ref, ) => { @@ -1015,6 +1017,9 @@ const ChatTextArea = forwardRef( ) // Focus the textarea after mode toggle with slight delay setTimeout(() => { + if (isTaskView) { + setInputValue("") + } textAreaRef.current?.focus() }, 100) }, changeModeDelay) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 9675423b..3702d535 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -1306,6 +1306,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie scrollToBottomAuto() } }} + isTaskView={!!task} /> )