From f75470e72f0993dcf92accc81282adaa48b16f56 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Sun, 4 Oct 2026 23:41:41 +0800 Subject: [PATCH] fix(webui): dismiss mobile sidebar on current topic selection --- webui/src/components/ChatList.tsx | 2 +- webui/src/tests/app-layout.test.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webui/src/components/ChatList.tsx b/webui/src/components/ChatList.tsx index 5bbeb60ba..380c9c30f 100644 --- a/webui/src/components/ChatList.tsx +++ b/webui/src/components/ChatList.tsx @@ -1007,7 +1007,7 @@ export const ChatList = memo(function ChatList({ toggleDeleteSelection(tabDeleteKeys, event.shiftKey, s.key); return; } - if (!topicActive) onSelect(s.key); + onSelect(s.key); }} draggable={canDragSession} onDragStart={(event) => { diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsx index b2dbe8ce2..d8954b331 100644 --- a/webui/src/tests/app-layout.test.tsx +++ b/webui/src/tests/app-layout.test.tsx @@ -2394,7 +2394,7 @@ describe("App layout", () => { expect(screen.queryByText("Daily repo check")).not.toBeInTheDocument(); }, 15_000); - it("opens a mobile topic with one click and closes the drawer without a search tooltip", async () => { + it("closes the mobile drawer when selecting a new or current topic without a search tooltip", async () => { restoreBrowserFocus = mockBrowserFocus(); const user = userEvent.setup(); mockSessions = ["First", "Second"].map((title, index) => ({ @@ -2418,7 +2418,7 @@ describe("App layout", () => { render(); await waitFor(() => expect(connectSpy).toHaveBeenCalled()); - for (const title of ["First", "Second"]) { + for (const title of ["First", "First", "Second"]) { await user.click(await screen.findByRole("button", { name: "Toggle sidebar" })); const sheet = await screen.findByRole("dialog"); await waitFor(() => expect(sheet).toHaveFocus());