The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): un-nest the session row's drag handle from its primary button
Brooklyn Nicholsonde5bb705dbfb
diff --git a/apps/desktop/src/app/chat/sidebar/session-row.test.tsx b/apps/desktop/src/app/chat/sidebar/session-row.test.tsxindex 501b0de8d40..f9d00be8144 100644--- a/apps/desktop/src/app/chat/sidebar/session-row.test.tsx+++ b/apps/desktop/src/app/chat/sidebar/session-row.test.tsx@@ -295,7 +295,7 @@ describe('SidebarSessionRow', () => {// reached the KeyboardSensor's activator — a drag armed, and the sensor then// ate the next Space at window level (the rename input dropped the keystroke).describe('SidebarSessionRow inside the sortable list', () => {- function SortableRow({ session }: { session: SessionInfo }) {+ function SortableRow({ onResume, session }: { onResume: () => void; session: SessionInfo }) {const { dragHandleProps, dragging, ref, reorderable, style } = useSortableBindings(session.id)return (@@ -307,7 +307,7 @@ describe('SidebarSessionRow inside the sortable list', () => {onArchive={noop}onDelete={noop}onPin={noop}- onResume={noop}+ onResume={onResume}onToggleUnread={noop}ref={ref}reorderable={reorderable}@@ -318,7 +318,7 @@ describe('SidebarSessionRow inside the sortable list', () => {)}- function Host({ session }: { session: SessionInfo }) {+ function Host({ onResume, session }: { onResume: () => void; session: SessionInfo }) {// The sidebar's own sensor set (index.tsx dndSensors).const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }),@@ -327,7 +327,7 @@ describe('SidebarSessionRow inside the sortable list', () => {return (<ReorderableList ids={[session.id]} onReorder={noop} sensors={sensors}>- <SortableRow session={session} />+ <SortableRow onResume={onResume} session={session} /></ReorderableList>)}@@ -335,7 +335,7 @@ describe('SidebarSessionRow inside the sortable list', () => {const space = { code: 'Space', key: ' ' }it('lets Space through to a focused row control instead of arming a keyboard drag', () => {- const { container } = render(<Host session={makeSession({ title: 'Renamable' })} />)+ const { container } = render(<Host onResume={noop} session={makeSession({ title: 'Renamable' })} />)const kebab = screen.getByRole('button', { name: 'Session actions' })kebab.focus()@@ -346,13 +346,38 @@ describe('SidebarSessionRow inside the sortable list', () => {})it('still starts a keyboard reorder from the grabber', () => {- const { container } = render(<Host session={makeSession({ title: 'Renamable' })} />)+ const { container } = render(<Host onResume={noop} session={makeSession({ title: 'Renamable' })} />)const grabber = container.querySelector<HTMLElement>('[data-reorder-handle]')!grabber.focus()fireEvent.keyDown(grabber, space)expect(grabber.getAttribute('aria-pressed')).toBe('true')})++ // #38072 finding 3 (axe nested-interactive): the grabber (dnd-kit+ // role="button" + tabIndex) must be a SIBLING of the row's primary action,+ // never a descendant of it. The row body is a div carrying the gesture+ // handlers; the title is the row's real button and its click bubbles to+ // the body's resolver, so pointer users keep click-anywhere-on-the-row.+ it('renders the grabber outside any button, with the title as the row button', () => {+ const onResume = vi.fn()+ const { container } = render(<Host onResume={onResume} session={makeSession({ title: 'Renamable' })} />)++ const grabber = container.querySelector<HTMLElement>('[data-reorder-handle]')!++ // Handle semantics survive (keyboard reorder above depends on them)…+ expect(grabber.getAttribute('role')).toBe('button')+ expect(grabber.tabIndex).toBe(0)+ // …but it no longer nests inside the row's primary button.+ expect(grabber.closest('button')).toBeNull()++ // The title line is the row button; clicks on it resume via the body+ // div's bubbled resolver (no onClick of its own).+ const title = screen.getByRole('button', { name: 'Renamable' })+ expect(title.closest('[data-reorder-handle]')).toBeNull()+ fireEvent.click(title)+ expect(onResume).toHaveBeenCalledTimes(1)+ })})// Row-decoration slots: a plugin decorates rows through the registry with thediff --git a/apps/desktop/src/app/chat/sidebar/session-row.tsx b/apps/desktop/src/app/chat/sidebar/session-row.tsxindex df0f839e848..292af34b51b 100644--- a/apps/desktop/src/app/chat/sidebar/session-row.tsx+++ b/apps/desktop/src/app/chat/sidebar/session-row.tsx@@ -11,6 +11,7 @@ import { openSession } from '@/app/open-session'import { formatMessageTimestamp } from '@/components/assistant-ui/thread/timestamp'import { Button } from '@/components/ui/button'import { Codicon } from '@/components/ui/codicon'+import { RowButton } from '@/components/ui/row-button'import { OverflowTip, Tip } from '@/components/ui/tooltip'import type { SessionInfo } from '@/hermes'import { type Translations, useI18n } from '@/i18n'@@ -41,7 +42,7 @@ import { SessionStatusDot } from '../session-status-dot'import {SIDEBAR_ROW_CARD_MIN_H,SIDEBAR_TRUNCATED_LEADING,- SidebarRowBody,+ SidebarRowCluster,SidebarRowGrab,SidebarRowLabel,SidebarRowLead,@@ -430,7 +431,15 @@ function SidebarSessionRowImpl({{...rest}>{showsRunningArc(dotState) && <span aria-hidden="true" className="arc-border arc-row" />}- <SidebarRowBody+ {/* #38072 finding 3: the row's body is a DIV, not a button — the+ reorder grabber (dnd-kit role="button" + tabIndex, kept for+ keyboard reorder, #83617) and the ⋯ trigger must be SIBLINGS of+ the row's primary action, never nested inside it (axe+ nested-interactive). The title below is the row's real button:+ its click bubbles to this div's handlers, so pointer users keep+ click-anywhere-on-the-row, and keyboard users get one clean tab+ stop per row instead of an ambiguous nested one. */}+ <SidebarRowCluster// Every trailing figure lives in the actions slot, which the row// measures — so the title needs a gap from it and nothing else. Hover// changes what you can see in that slot, never how wide it is. The@@ -438,7 +447,10 @@ function SidebarSessionRowImpl({// ending at the shell's own trailing inset), and keeping the gap// would pull the header in past every line below it.className={cn(- 'z-0',+ // cursor-pointer: the body is a div now (see #38072 note above);+ // buttons earn this from the base layer's interactive-control+ // rule, a div doesn't.+ 'z-0 w-full cursor-pointer',card && 'pr-0',branchStem && 'pl-3.5',// The card is a grid with ONE spacing knob: --card-gap. Every row@@ -539,15 +551,25 @@ function SidebarSessionRowImpl({{handoffBadge}{continuationBadge}<span className="min-w-0 flex-1 self-center">- <OverflowTip label={title} placement="row">- <SidebarRowLabel- className="hover-marquee block font-normal group-hover:text-foreground group-data-[working=true]:text-foreground/90"- onPointerEnter={armMarquee}- onPointerLeave={disarmMarquee}- >- <span className="hover-marquee-inner">{title}</span>- </SidebarRowLabel>- </OverflowTip>+ {/* The row's primary action (#38072 finding 3): the title+ is the session row's real button — the grabber and ⋯+ sit beside it as siblings, never inside it. No onClick+ of its own: the click bubbles to the body div's+ resolver, so modifier-clicks and plain clicks behave+ exactly as they did on the old full-row button. The+ OverflowTip stays on the truncating label so its+ scrollWidth measurement is unchanged. */}+ <RowButton className="block w-full text-left">+ <OverflowTip label={title} placement="row">+ <SidebarRowLabel+ className="hover-marquee block font-normal group-hover:text-foreground group-data-[working=true]:text-foreground/90"+ onPointerEnter={armMarquee}+ onPointerLeave={disarmMarquee}+ >+ <span className="hover-marquee-inner">{title}</span>+ </SidebarRowLabel>+ </OverflowTip>+ </RowButton>{/* Session-list density (#68119): comfortable adds onedeterministic metadata line; detailed adds the initialrequest preview. Compact keeps today's one-line row. */}@@ -603,18 +625,23 @@ function SidebarSessionRowImpl({{/* Title + preview: ONE grouped cell with its own tightinternal gap — it does not inherit the card's rhythm. */}<div className="flex min-w-0 flex-col gap-[0.15rem]">- <OverflowTip label={title} placement="row">- <SidebarRowLabel- className={cn(- 'hover-marquee text-[0.8125rem] font-medium text-(--ui-text-primary) group-data-[working=true]:text-foreground',- SIDEBAR_TRUNCATED_LEADING- )}- onPointerEnter={armMarquee}- onPointerLeave={disarmMarquee}- >- <span className="hover-marquee-inner">{title}</span>- </SidebarRowLabel>- </OverflowTip>+ {/* #38072 finding 3: the card's title line is the row's real+ button (same contract as the flat row: no onClick of its+ own — the click bubbles to the body div's resolver). */}+ <RowButton className="block w-full text-left">+ <OverflowTip label={title} placement="row">+ <SidebarRowLabel+ className={cn(+ 'hover-marquee text-[0.8125rem] font-medium text-(--ui-text-primary) group-data-[working=true]:text-foreground',+ SIDEBAR_TRUNCATED_LEADING+ )}+ onPointerEnter={armMarquee}+ onPointerLeave={disarmMarquee}+ >+ <span className="hover-marquee-inner">{title}</span>+ </SidebarRowLabel>+ </OverflowTip>+ </RowButton>{session.preview && rowMeta.includes('preview') ? (<spanclassName={cn(@@ -645,7 +672,7 @@ function SidebarSessionRowImpl({</>)})()}- </SidebarRowBody>+ </SidebarRowCluster></SidebarRowShell></SessionContextMenu>)