diff --git a/ui/goose2/src/features/chat/ui/ChatInput.tsx b/ui/goose2/src/features/chat/ui/ChatInput.tsx
index b51dea1d04..af5ee937a7 100644
--- a/ui/goose2/src/features/chat/ui/ChatInput.tsx
+++ b/ui/goose2/src/features/chat/ui/ChatInput.tsx
@@ -279,7 +279,7 @@ export function ChatInput({
}
}
}
- if (e.key === "Enter" && !e.shiftKey) {
+ if (e.key === "Enter" && !e.shiftKey && !e.altKey) {
e.preventDefault();
handleSend();
}
diff --git a/ui/goose2/src/features/chat/ui/__tests__/ChatInput.test.tsx b/ui/goose2/src/features/chat/ui/__tests__/ChatInput.test.tsx
index 46b51d04bb..8e7942331c 100644
--- a/ui/goose2/src/features/chat/ui/__tests__/ChatInput.test.tsx
+++ b/ui/goose2/src/features/chat/ui/__tests__/ChatInput.test.tsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi } from "vitest";
-import { render, screen } from "@testing-library/react";
+import { fireEvent, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { useState } from "react";
import { ChatInput } from "../ChatInput";
@@ -75,6 +75,23 @@ describe("ChatInput", () => {
expect(onSend).not.toHaveBeenCalled();
});
+ it("does not call onSend on Alt+Enter (newline)", async () => {
+ const onSend = vi.fn();
+ const user = userEvent.setup();
+ render();
+
+ const input = screen.getByRole("textbox");
+ await user.type(input, "hello");
+ const wasNotPrevented = fireEvent.keyDown(input, {
+ altKey: true,
+ key: "Enter",
+ });
+
+ expect(wasNotPrevented).toBe(true);
+ expect(onSend).not.toHaveBeenCalled();
+ expect(input).toHaveValue("hello");
+ });
+
it("shows current model name in model picker", () => {
render(
{
+ it("does not submit on Alt+Enter and inserts a newline", async () => {
+ const onSubmit = vi.fn();
+ const user = userEvent.setup();
+
+ render(
+
+
+
+ ,
+ );
+
+ const input = screen.getByRole("textbox");
+ await user.type(input, "hello");
+ const wasNotPrevented = fireEvent.keyDown(input, {
+ altKey: true,
+ key: "Enter",
+ });
+
+ expect(wasNotPrevented).toBe(true);
+ expect(onSubmit).not.toHaveBeenCalled();
+ expect(input).toHaveValue("hello");
+ });
+});
diff --git a/ui/goose2/src/shared/ui/ai-elements/prompt-input.tsx b/ui/goose2/src/shared/ui/ai-elements/prompt-input.tsx
index ba9299ecb2..2f5496497c 100644
--- a/ui/goose2/src/shared/ui/ai-elements/prompt-input.tsx
+++ b/ui/goose2/src/shared/ui/ai-elements/prompt-input.tsx
@@ -972,7 +972,7 @@ export const PromptInputTextarea = ({
if (isComposing || e.nativeEvent.isComposing) {
return;
}
- if (e.shiftKey) {
+ if (e.shiftKey || e.altKey) {
return;
}
e.preventDefault();