The best way to control Claude Code, Codex and more from any computer or phone
fix(web): Escape that cancels a thread rename no longer also closes the find bar (#36768)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
preet committed
Nov 14, 2026 at 20:00 UTC
6cb47acfb8c1e9913c8760a5b677dbf63361a501
2 files changed
+24
apps/web/src/components/chat/ChatHeader.browser.test.tsx
+23
@@ -80,3 +80,26 @@ it("opens the thread menu on a desktop title click without waiting", async () =>
80
await screen.getByRole("button", { name: "Thread actions for New thread" }).click();
81
expect(openMenu).toHaveBeenCalledOnce();
82
});
83
+
84
+it("keeps the Escape that cancels a rename from also reaching window shortcuts", async () => {
85
+ persisted.title = "New thread";
86
+ await using screen = await render(header(persisted.title));
87
+ await screen.getByRole("button", { name: "Thread actions for New thread" }).dblClick();
88
+ const input = screen.getByRole("textbox", { name: "Thread title" });
89
+ await input.fill("Unsaved title");
90
+
91
+ // The thread find bar closes from a window keydown listener that skips handled events.
92
+ const windowEscapes: boolean[] = [];
93
+ const recordEscape = (event: KeyboardEvent) => {
94
+ if (event.key === "Escape") windowEscapes.push(event.defaultPrevented);
95
+ };
96
+ window.addEventListener("keydown", recordEscape);
97
+ using _listener = {
98
+ [Symbol.dispose]: () => window.removeEventListener("keydown", recordEscape),
99
+ };
100
+ await userEvent.keyboard("{Escape}");
101
+
102
+ await expect.element(input).not.toBeInTheDocument();
103
+ expect(persisted.title).toBe("New thread");
104
+ expect(windowEscapes).toEqual([true]);
105
+});
apps/web/src/components/chat/ChatHeader.tsx
+1
@@ -240,6 +240,7 @@ export const ChatHeader = memo(function ChatHeader({
240
renameCommittedRef.current = true;
241
commitRename(event.currentTarget.value);
242
} else if (event.key === "Escape") {
243
+ event.preventDefault();
244
renameCommittedRef.current = true;
245
setRenaming(null);
246
}