From 21fb0c27ff474885a666ea2524cc596351861738 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 30 Sep 2025 20:08:21 +0000 Subject: [PATCH 1/3] fix: show send button when only images are selected in chat textarea - Updated hasInputContent logic to check for both text content and selected images - Added comprehensive tests for send button visibility scenarios - Fixes issue where send button was hidden when user had only attached images --- tmp/Roo-Code | 1 + tmp/Roo-Code-rc | 1 + .../src/components/chat/ChatTextArea.tsx | 6 +- .../chat/__tests__/ChatTextArea.spec.tsx | 66 +++++++++++++++++++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 160000 tmp/Roo-Code create mode 160000 tmp/Roo-Code-rc diff --git a/tmp/Roo-Code b/tmp/Roo-Code new file mode 160000 index 00000000000..8111da66bd5 --- /dev/null +++ b/tmp/Roo-Code @@ -0,0 +1 @@ +Subproject commit 8111da66bd59ca8d500e5eae23b24a0419ed7345 diff --git a/tmp/Roo-Code-rc b/tmp/Roo-Code-rc new file mode 160000 index 00000000000..7b7bb495729 --- /dev/null +++ b/tmp/Roo-Code-rc @@ -0,0 +1 @@ +Subproject commit 7b7bb49572975c4aeff2381a0ebea99b3aa4542c diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index 993912f240e..c7813372fa7 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -247,10 +247,10 @@ export const ChatTextArea = forwardRef( const allModes = useMemo(() => getAllModes(customModes), [customModes]) - // Memoized check for whether the input has content + // Memoized check for whether the input has content (text or images) const hasInputContent = useMemo(() => { - return inputValue.trim().length > 0 - }, [inputValue]) + return inputValue.trim().length > 0 || selectedImages.length > 0 + }, [inputValue, selectedImages]) const queryItems = useMemo(() => { return [ diff --git a/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx b/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx index 23c365ab591..ef1fa8becf1 100644 --- a/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx +++ b/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx @@ -1057,4 +1057,70 @@ describe("ChatTextArea", () => { expect(apiConfigDropdown).toHaveAttribute("disabled") }) }) + + describe("send button visibility", () => { + it("should show send button when there are images but no text", () => { + const { container } = render( + , + ) + + // Find the send button by its icon + const sendButton = container.querySelector('button[aria-label="Send message"]') + expect(sendButton).toBeInTheDocument() + + // Check that the button is visible (has opacity-100 class when content exists) + expect(sendButton).toHaveClass("opacity-100") + expect(sendButton).toHaveClass("pointer-events-auto") + expect(sendButton).not.toHaveClass("opacity-0") + expect(sendButton).not.toHaveClass("pointer-events-none") + }) + + it("should hide send button when there is no text and no images", () => { + const { container } = render() + + // Find the send button by its icon + const sendButton = container.querySelector('button[aria-label="Send message"]') + expect(sendButton).toBeInTheDocument() + + // Check that the button is hidden (has opacity-0 class when no content) + expect(sendButton).toHaveClass("opacity-0") + expect(sendButton).toHaveClass("pointer-events-none") + expect(sendButton).not.toHaveClass("opacity-100") + expect(sendButton).not.toHaveClass("pointer-events-auto") + }) + + it("should show send button when there is text but no images", () => { + const { container } = render() + + // Find the send button by its icon + const sendButton = container.querySelector('button[aria-label="Send message"]') + expect(sendButton).toBeInTheDocument() + + // Check that the button is visible + expect(sendButton).toHaveClass("opacity-100") + expect(sendButton).toHaveClass("pointer-events-auto") + }) + + it("should show send button when there is both text and images", () => { + const { container } = render( + , + ) + + // Find the send button by its icon + const sendButton = container.querySelector('button[aria-label="Send message"]') + expect(sendButton).toBeInTheDocument() + + // Check that the button is visible + expect(sendButton).toHaveClass("opacity-100") + expect(sendButton).toHaveClass("pointer-events-auto") + }) + }) }) From 059238bb90cb9214502b0d84946b9a06e1b9c506 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 30 Sep 2025 20:10:25 +0000 Subject: [PATCH 2/3] test: fix send button visibility tests to use correct selector --- .../chat/__tests__/ChatTextArea.spec.tsx | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx b/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx index ef1fa8becf1..af7704aa1b7 100644 --- a/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx +++ b/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx @@ -1068,8 +1068,12 @@ describe("ChatTextArea", () => { />, ) - // Find the send button by its icon - const sendButton = container.querySelector('button[aria-label="Send message"]') + // Find the send button by looking for the button with SendHorizontal icon + const buttons = container.querySelectorAll("button") + const sendButton = Array.from(buttons).find( + (button) => button.querySelector(".lucide-send-horizontal") !== null, + ) + expect(sendButton).toBeInTheDocument() // Check that the button is visible (has opacity-100 class when content exists) @@ -1082,8 +1086,12 @@ describe("ChatTextArea", () => { it("should hide send button when there is no text and no images", () => { const { container } = render() - // Find the send button by its icon - const sendButton = container.querySelector('button[aria-label="Send message"]') + // Find the send button by looking for the button with SendHorizontal icon + const buttons = container.querySelectorAll("button") + const sendButton = Array.from(buttons).find( + (button) => button.querySelector(".lucide-send-horizontal") !== null, + ) + expect(sendButton).toBeInTheDocument() // Check that the button is hidden (has opacity-0 class when no content) @@ -1096,8 +1104,12 @@ describe("ChatTextArea", () => { it("should show send button when there is text but no images", () => { const { container } = render() - // Find the send button by its icon - const sendButton = container.querySelector('button[aria-label="Send message"]') + // Find the send button by looking for the button with SendHorizontal icon + const buttons = container.querySelectorAll("button") + const sendButton = Array.from(buttons).find( + (button) => button.querySelector(".lucide-send-horizontal") !== null, + ) + expect(sendButton).toBeInTheDocument() // Check that the button is visible @@ -1114,8 +1126,12 @@ describe("ChatTextArea", () => { />, ) - // Find the send button by its icon - const sendButton = container.querySelector('button[aria-label="Send message"]') + // Find the send button by looking for the button with SendHorizontal icon + const buttons = container.querySelectorAll("button") + const sendButton = Array.from(buttons).find( + (button) => button.querySelector(".lucide-send-horizontal") !== null, + ) + expect(sendButton).toBeInTheDocument() // Check that the button is visible From 8b719778285cd92ea277912a251a31ce0870a2bb Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Tue, 30 Sep 2025 16:29:30 -0400 Subject: [PATCH 3/3] Ugh --- tmp/Roo-Code | 1 - tmp/Roo-Code-rc | 1 - 2 files changed, 2 deletions(-) delete mode 160000 tmp/Roo-Code delete mode 160000 tmp/Roo-Code-rc diff --git a/tmp/Roo-Code b/tmp/Roo-Code deleted file mode 160000 index 8111da66bd5..00000000000 --- a/tmp/Roo-Code +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8111da66bd59ca8d500e5eae23b24a0419ed7345 diff --git a/tmp/Roo-Code-rc b/tmp/Roo-Code-rc deleted file mode 160000 index 7b7bb495729..00000000000 --- a/tmp/Roo-Code-rc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7b7bb49572975c4aeff2381a0ebea99b3aa4542c