From d8e29263df8b94dbc383680795f0d9293dac37e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Barreiro?= <52393857+BarreiroT@users.noreply.github.com> Date: Tue, 17 Jun 2025 08:44:52 -0700 Subject: [PATCH] fix: Clear the input when the user changes mode within a task (#4242) * Clear the input when the user changes mode within a task * Add changeset * rename prop --- .changeset/mighty-pillows-pretend.md | 5 +++++ webview-ui/src/components/chat/ChatTextArea.tsx | 5 +++++ webview-ui/src/components/chat/ChatView.tsx | 1 + 3 files changed, 11 insertions(+) create mode 100644 .changeset/mighty-pillows-pretend.md 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} /> )