diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index e72c1726f3..c9510992f8 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -491,8 +491,8 @@ export const ChatTextArea = forwardRef( // Handle Enter key based on enterBehavior setting if (event.key === "Enter" && !isComposing) { if (enterBehavior === "newline") { - // New behavior: Enter = newline, Shift+Enter or Ctrl+Enter = send - if (event.shiftKey || event.ctrlKey || event.metaKey) { + // New behavior: Enter/Shift+Enter = newline, Ctrl/Cmd+Enter = send + if (event.ctrlKey || event.metaKey) { event.preventDefault() resetHistoryNavigation() onSend() diff --git a/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx b/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx index 0b63a68f4e..0bd1113fed 100644 --- a/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx +++ b/webview-ui/src/components/chat/__tests__/ChatTextArea.spec.tsx @@ -1081,7 +1081,7 @@ describe("ChatTextArea", () => { expect(shiftEnterEvent.defaultPrevented).toBe(false) }) - it("should treat Ctrl/Cmd/Shift+Enter as send and plain Enter as newline in newline mode", () => { + it("should treat Ctrl/Cmd+Enter as send and plain Enter/Shift+Enter as newline in newline mode", () => { const onSend = vi.fn() ;(useExtensionState as ReturnType).mockReturnValue({ @@ -1118,8 +1118,8 @@ describe("ChatTextArea", () => { cancelable: true, }) fireEvent(textarea, shiftEnterEvent) - expect(onSend).toHaveBeenCalledTimes(2) - expect(shiftEnterEvent.defaultPrevented).toBe(true) + expect(onSend).toHaveBeenCalledTimes(1) // Shift+Enter should NOT send + expect(shiftEnterEvent.defaultPrevented).toBe(false) // Should allow newline }) }) })