The best way to control Claude Code, Codex and more from any computer or phone
fix(web): sidebar search results can be dragged onto the composer (#28016)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
Srivishal Sivasubramanian committed
Nov 9, 2026 at 03:26 UTC
ecea300d3c63f757efcfb6e90e4cbd1f18aa7129
2 files changed
+73
-52
apps/web/src/components/Sidebar.tsx
+62
-51
@@ -1042,6 +1042,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1042
const [renamingTitle, setRenamingTitle] = useState("");
1043
const settlingThreadKeysRef = useRef(new Set<string>());
1044
const threadListRef = useRef<HTMLUListElement | null>(null);
1045
+ const searchResultsListRef = useRef<HTMLUListElement | null>(null);
1046
const sidebarContentRef = useRef<HTMLDivElement | null>(null);
1047
const dragLabelOffsetRef = useRef(0);
1048
const listMotionRef = useRef<ReturnType<typeof createSidebarListMotion> | null>(null);
@@ -1738,7 +1739,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
1739
});
1740
};
1741
const pointerOutsideThreadList = (point: { x: number; y: number }) => {
1741
- const bounds = threadListRef.current?.getBoundingClientRect();
1742
+ // Search results replace the thread list, so only one of them is mounted.
1743
+ const bounds = (threadListRef.current ?? searchResultsListRef.current)?.getBoundingClientRect();
1744
return bounds !== undefined && (point.x < bounds.left || point.x > bounds.right);
1745
};
1746
// The path out of the list often crosses dnd-kit's edge zone, which autoscrolls the sidebar.
@@ -3225,57 +3227,66 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
3227
closeDelay={0}
3228
timeout={400}
3229
>
3228
- <ul
3229
- id="sidebar-thread-search-results"
3230
- role="listbox"
3231
- aria-label="Thread search results"
3232
- className="flex flex-col gap-px"
3230
+ <DndContext
3231
+ sensors={dndSensors}
3232
+ autoScroll={false}
3233
+ onDragStart={(event) => {
3234
+ contextDragKeyRef.current = String(event.active.id);
3235
+ }}
3236
>
3234
- {threadSearchResults.map((thread, index) => {
3235
- const threadKey = scopedThreadKey(
3236
- scopeThreadRef(thread.environmentId, thread.id),
3237
- );
3238
- return (
3239
- <SidebarSearchResultRow
3240
- isSettled={settledThreadKeys.has(threadKey)}
3241
- key={threadKey}
3242
- thread={thread}
3243
- project={
3244
- projectByKey.get(`${thread.environmentId}:${thread.projectId}`) ?? null
3245
- }
3246
- projectDisplayName={
3247
- projectDisplayNameByKey.get(
3248
- `${thread.environmentId}:${thread.projectId}`,
3249
- ) ?? null
3250
- }
3251
- environmentLabel={environmentLabelById.get(thread.environmentId) ?? null}
3252
- environmentMachine={
3253
- environmentMachineById.get(thread.environmentId) ?? "server"
3254
- }
3255
- providerEntryByInstanceId={
3256
- providerEntriesByEnvironment.get(thread.environmentId) ??
3257
- EMPTY_PROVIDER_ENTRIES
3258
- }
3259
- isHighlighted={activeSearchResultIndex === index}
3260
- isRouteActive={routeRowThreadKey === threadKey}
3261
- resultId={threadSearchResultId(index)}
3262
- searchMatch={
3263
- threadSearchMatchByKey.get(
3264
- threadSearchMatchKey({
3265
- environmentId: thread.environmentId,
3266
- threadId: thread.id,
3267
- }),
3268
- ) ?? null
3269
- }
3270
- searchQuery={threadSearchQuery}
3271
- searchMatchQuery={threadSearch.query}
3272
- onHighlight={() => setActiveSearchResultIndex(index)}
3273
- onSelect={() => selectThreadSearchResult(thread)}
3274
- onFileDropThreads={handleThreadFileDrop}
3275
- />
3276
- );
3277
- })}
3278
- </ul>
3237
+ <ul
3238
+ ref={searchResultsListRef}
3239
+ id="sidebar-thread-search-results"
3240
+ role="listbox"
3241
+ aria-label="Thread search results"
3242
+ className="flex flex-col gap-px"
3243
+ >
3244
+ {threadSearchResults.map((thread, index) => {
3245
+ const threadKey = scopedThreadKey(
3246
+ scopeThreadRef(thread.environmentId, thread.id),
3247
+ );
3248
+ return (
3249
+ <SidebarSearchResultRow
3250
+ isSettled={settledThreadKeys.has(threadKey)}
3251
+ key={threadKey}
3252
+ thread={thread}
3253
+ project={
3254
+ projectByKey.get(`${thread.environmentId}:${thread.projectId}`) ?? null
3255
+ }
3256
+ projectDisplayName={
3257
+ projectDisplayNameByKey.get(
3258
+ `${thread.environmentId}:${thread.projectId}`,
3259
+ ) ?? null
3260
+ }
3261
+ environmentLabel={environmentLabelById.get(thread.environmentId) ?? null}
3262
+ environmentMachine={
3263
+ environmentMachineById.get(thread.environmentId) ?? "server"
3264
+ }
3265
+ providerEntryByInstanceId={
3266
+ providerEntriesByEnvironment.get(thread.environmentId) ??
3267
+ EMPTY_PROVIDER_ENTRIES
3268
+ }
3269
+ isHighlighted={activeSearchResultIndex === index}
3270
+ isRouteActive={routeRowThreadKey === threadKey}
3271
+ resultId={threadSearchResultId(index)}
3272
+ searchMatch={
3273
+ threadSearchMatchByKey.get(
3274
+ threadSearchMatchKey({
3275
+ environmentId: thread.environmentId,
3276
+ threadId: thread.id,
3277
+ }),
3278
+ ) ?? null
3279
+ }
3280
+ searchQuery={threadSearchQuery}
3281
+ searchMatchQuery={threadSearch.query}
3282
+ onHighlight={() => setActiveSearchResultIndex(index)}
3283
+ onSelect={() => selectThreadSearchResult(thread)}
3284
+ onFileDropThreads={handleThreadFileDrop}
3285
+ />
3286
+ );
3287
+ })}
3288
+ </ul>
3289
+ </DndContext>
3290
</TooltipProvider>
3291
) : (
3292
<p
apps/web/src/components/sidebar/SidebarThreadRow.tsx
+11
-1
@@ -6,6 +6,7 @@ import { requestCustomSnooze } from "../CustomSnoozeDialog";
6
import { useSupportsMultiplePullRequests } from "~/hooks/useSupportsMultiplePullRequests";
7
import { useDeadlinePassed } from "~/hooks/useDeadline";
8
import { resolveThreadCurrentPullRequestLink } from "@t3tools/client-runtime/thread-pull-requests";
9
+import { useDraggable } from "@dnd-kit/core";
10
import { useSortable } from "@dnd-kit/sortable";
11
import { CSS } from "@dnd-kit/utilities";
12
import {
@@ -1642,9 +1643,17 @@ export const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props
1643
isActive: props.isRouteActive,
1644
});
1645
const threadRef = scopeThreadRef(thread.environmentId, thread.id);
1645
- const { leaseLiveStatus, rowRef } = useSidebarRowSubscriptionLease(
1646
+ // Results only drag out as chat context; the row keeps its own listbox attributes.
1647
+ const { listeners: dragListeners, setNodeRef: setDragNodeRef } = useDraggable({
1648
+ id: scopedThreadKey(threadRef),
1649
+ });
1650
+ const { leaseLiveStatus, rowRef: leaseRowRef } = useSidebarRowSubscriptionLease(
1651
props.isHighlighted || props.isRouteActive,
1652
);
1653
+ const rowRef = (row: HTMLElement | null) => {
1654
+ setDragNodeRef(row);
1655
+ return leaseRowRef(row);
1656
+ };
1657
const gitCwd = thread.worktreePath ?? props.project?.workspaceRoot ?? null;
1658
const branchTarget =
1659
leaseLiveStatus && (thread.branch != null || thread.worktreePath !== null) && gitCwd !== null
@@ -1714,6 +1723,7 @@ export const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props
1723
aria-current={accessibility.current}
1724
aria-describedby={`${props.resultId}-pr`}
1725
aria-label={accessibility.label}
1726
+ {...dragListeners}
1727
onMouseMove={props.onHighlight}
1728
onClick={props.onSelect}
1729
className={cn(