@devries-cameron20 / t3code Mirror · read-only / commits / d6c1d17793
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 12:15 UTC

fix(web): show drag preview inside sidebar search results (#37022)

Yash Singh committed Nov 14, 2026 at 20:27 UTC d6c1d17793948057d3bd40ac2534bae1527c6824
2 files changed +22 -3
apps/web/src/components/Sidebar.drag.browser.test.tsx
+20 -2
@@ -34,7 +34,7 @@ vi.mock(import("~/rpc/requestLatencyState"), async (original) => ({
34 trackRpcRequestSent: () => {},
35 }));
36
37 -it("keeps the title when dragging a search result from a collapsed folder", async () => {
37 +it("shows the titled preview inside and outside search results from a collapsed folder", async () => {
38 await page.viewport(1400, 900);
39 const [first, second] = [threadWithHistory("visible", 1), threadWithHistory("search-target", 1)];
40 using _environment = installFakeEnvironment([first, second]);
@@ -80,13 +80,31 @@ it("keeps the title when dragging a search result from a collapsed folder", asyn
80 };
81 await act(() => {
82 result.element().dispatchEvent(pointer("pointerdown", bounds.x + 10, bounds.y + 10));
83 - document.dispatchEvent(pointer("pointermove", -100, 100));
83 + document.dispatchEvent(pointer("pointermove", bounds.x + 30, bounds.y + 10));
84 });
85 await vi.waitFor(() => {
86 expect(
87 document.querySelector('body > div[aria-hidden="true"].pointer-events-none')?.textContent,
88 ).toBe(second.title);
89 });
90 + await act(() => document.dispatchEvent(pointer("pointermove", -100, 100)));
91 + await vi.waitFor(() => {
92 + expect(
93 + document.querySelector('body > div[aria-hidden="true"].pointer-events-none')?.textContent,
94 + ).toBe(second.title);
95 + });
96 + await act(() => document.dispatchEvent(pointer("pointermove", bounds.x + 30, bounds.y + 10)));
97 + await vi.waitFor(() => {
98 + expect(
99 + document.querySelector('body > div[aria-hidden="true"].pointer-events-none')?.textContent,
100 + ).toBe(second.title);
101 + });
102 + await act(() =>
103 + document.dispatchEvent(new KeyboardEvent("keydown", { code: "Escape", bubbles: true })),
104 + );
105 + await vi.waitFor(() => {
106 + expect(document.querySelector('body > div[aria-hidden="true"].pointer-events-none')).toBeNull();
107 + });
108 });
109
110 it("keeps focus in the search box when a click picks a search result", async () => {
apps/web/src/components/Sidebar.tsx
+2 -1
@@ -1763,7 +1763,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1763 if (scroll && scroll.viewport.scrollTop !== scroll.top) scroll.viewport.scrollTop = scroll.top;
1764 };
1765 const moveThreadContextDrag = (point: { x: number; y: number }) => {
1766 - const contextDrag = pointerOutsideThreadList(point);
1766 + // Search results cannot reorder, so their context preview starts inside the list.
1767 + const contextDrag = searchResultsListRef.current !== null || pointerOutsideThreadList(point);
1768 setDragState((current) =>
1769 current === null || current.contextDrag === contextDrag
1770 ? current