Skip to content

The agent that grows with you

refactor(desktop): state the shell/grabber handle split once, at useSortableBindings

kshitijk4poor61134dbcde94
diff --git a/apps/desktop/src/app/chat/sidebar/gateway-groups-drag.test.tsx b/apps/desktop/src/app/chat/sidebar/gateway-groups-drag.test.tsx
index bfaaf4dfbf6..a652c699913 100644
--- a/apps/desktop/src/app/chat/sidebar/gateway-groups-drag.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/gateway-groups-drag.test.tsx
@@ -18,9 +18,7 @@ import { ChatSidebar } from './index'
// up/down. The grab handle only reveals itself on hover, so the visible
// affordance is the header itself: a POINTER press on the label must arm the
// dnd sortable (the lead handle already did). Only the pointer activator lives
-// on the header, though — the keyboard activator stays on the grabber, or
-// Space on the ⋯ button would arm a reorder and swallow the next Space in the
-// rename dialog (#83617).
+// on the header; the keyboard activator stays on the grabber (#83617).
const noop = () => {}
diff --git a/apps/desktop/src/app/chat/sidebar/gateway-groups.tsx b/apps/desktop/src/app/chat/sidebar/gateway-groups.tsx
index 592e983a62e..c108523841a 100644
--- a/apps/desktop/src/app/chat/sidebar/gateway-groups.tsx
+++ b/apps/desktop/src/app/chat/sidebar/gateway-groups.tsx
@@ -193,9 +193,7 @@ function GatewayProfileGroup({
// row must start the reorder too. The ⋯/caret cluster and the handle
// keep their own gestures; a sub-threshold press on the label is still
// the click that folds the group. Pointer activator only (forwarded
- // below): the keyboard activator stays on the grabber, or Space on the
- // ⋯ button would arm a reorder and swallow the next Space in the
- // rename dialog (#83617).
+ // below); the full handle stays on the grabber (see useSortableBindings).
actions={
<div className="flex items-center">
{group.profile && (
diff --git a/apps/desktop/src/app/chat/sidebar/projects/overview-row.tsx b/apps/desktop/src/app/chat/sidebar/projects/overview-row.tsx
index a8f736c1580..ba4a6197f51 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/overview-row.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/overview-row.tsx
@@ -222,11 +222,11 @@ export function ProjectOverviewRow({
data-glass-opaque={dragging ? '' : undefined}
label={project.isAuto ? <Tip label={s.projects.autoDiscovered}>{labelLink}</Tip> : labelLink}
lead={lead}
- // The label is grab surface too, not just the lead's grabber — same
- // listeners, minus the controls that keep their own gestures. A project
- // row has no rival drag (its title navigates on CLICK), so the sortable
- // owns the press outright. Pointer activator only — the keyboard
- // activator stays on the grabber (#83617).
+ // The label is grab surface too, not just the lead's grabber — the
+ // pointer activator only (the full handle stays on the grabber, see
+ // useSortableBindings), minus the controls that keep their own gestures.
+ // A project row has no rival drag (its title navigates on CLICK), so the
+ // sortable owns the press outright.
onPointerDown={event => {
if ((event.target as HTMLElement).closest('[data-reorder-handle], [data-row-actions]')) {
return
diff --git a/apps/desktop/src/app/chat/sidebar/reorderable-list.tsx b/apps/desktop/src/app/chat/sidebar/reorderable-list.tsx
index 62d1ed1cda4..29c25ca783d 100644
--- a/apps/desktop/src/app/chat/sidebar/reorderable-list.tsx
+++ b/apps/desktop/src/app/chat/sidebar/reorderable-list.tsx
@@ -63,6 +63,12 @@ export function ReorderableList({
export function useSortableBindings(id: string) {
const { attributes, isDragging, listeners, setNodeRef, transform, transition } = useSortable({ id })
+ // The FULL handle (role/tabIndex + dnd-kit's keyboard and pointer
+ // activators) belongs on the grabber only. Row shells forward just
+ // `onPointerDown` from it: a keyboard activator on a container makes every
+ // focused descendant control (the ⋯ menu button) arm a drag on Space, and
+ // an armed KeyboardSensor then eats Space/Enter window-wide — the rename
+ // dialog swallowed spaces (#83617).
const dragHandleProps: React.HTMLAttributes<HTMLElement> = { ...attributes, ...listeners }
return {
diff --git a/apps/desktop/src/app/chat/sidebar/session-row.tsx b/apps/desktop/src/app/chat/sidebar/session-row.tsx
index 9f9b4abc2f1..f627833ca62 100644
--- a/apps/desktop/src/app/chat/sidebar/session-row.tsx
+++ b/apps/desktop/src/app/chat/sidebar/session-row.tsx
@@ -376,13 +376,9 @@ function SidebarSessionRowImpl({
// steal the other's gesture. Over the sidebar only the reorder has a
// target (the session drop denies: side chrome hosts no main tile);
// over the tree only the session drop does (no sortable row there).
- // Whichever one the release lands on is the one that commits.
- //
- // Only the POINTER activator reaches the shell. The full handle
- // (role/tabIndex + dnd-kit's keyboard activator) lives on the grabber:
- // spread here it made every focused row control a keyboard drag
- // activator, and an armed KeyboardSensor eats Space/Enter window-wide
- // (#83617: the rename dialog swallowed spaces).
+ // Whichever one the release lands on is the one that commits. Pointer
+ // activator only; the full handle stays on the grabber (see
+ // useSortableBindings).
onPointerDown={event => {
// The grabber already carries these same listeners, and the ⋯
// cluster keeps its own gestures.