From b00223c413d56028133617b2fcf09082dbb2f8a0 Mon Sep 17 00:00:00 2001
From: Gabriel Stoltemberg <215755014+Stoltemberg@users.noreply.github.com>
Date: Fri, 31 Jul 2026 12:05:35 -0300
Subject: [PATCH 1/2] fix(desktop): collapse sidebar session-row actions track
The kebab/age actions cluster reserved a permanent 22px column on every sidebar row, leaving a dead band along the chat edge (#75331). Make the track collapse to 0 width and 0 opacity on idle rows and only grow on group-hover/focus-within/menu-open, so long session titles reach the chat edge.
---
apps/desktop/src/app/chat/sidebar/chrome.tsx | 10 ++-
.../src/app/chat/sidebar/session-row.test.tsx | 62 ++++++++++++++++++-
.../src/app/chat/sidebar/session-row.tsx | 18 ++++--
3 files changed, 83 insertions(+), 7 deletions(-)
diff --git a/apps/desktop/src/app/chat/sidebar/chrome.tsx b/apps/desktop/src/app/chat/sidebar/chrome.tsx
index 8e2da487829ac..091e9fb4e6e6e 100644
--- a/apps/desktop/src/app/chat/sidebar/chrome.tsx
+++ b/apps/desktop/src/app/chat/sidebar/chrome.tsx
@@ -65,7 +65,15 @@ export function SidebarRowShell({
return (
{children}
- {actions ?
{actions}
: null}
+ {/*
+ actions wrapper is shrink-0 so the actions slot owns its width, but
+ the slot itself is allowed to drop to 0px when idle (the kebab track
+ animates `w-[1.375rem] -> w-0` on hover-out). Previously the inner
+ track was permanently `w-[1.375rem]`, which produced the standing
+ gutter reported in #75331 — fixed by the inner actions slot, not
+ here, so the chrome itself remains the single source of row geometry.
+ */}
+ {actions ?
{actions}
: null}
)
}
diff --git a/apps/desktop/src/app/chat/sidebar/session-row.test.tsx b/apps/desktop/src/app/chat/sidebar/session-row.test.tsx
index dced1a0931fff..cc241397b48b9 100644
--- a/apps/desktop/src/app/chat/sidebar/session-row.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/session-row.test.tsx
@@ -1,4 +1,5 @@
import { cleanup, render, screen } from '@testing-library/react'
+import { fireEvent } from '@testing-library/react'
import { atom } from 'nanostores'
import type * as React from 'react'
import { afterEach, describe, expect, it, vi } from 'vitest'
@@ -113,10 +114,67 @@ function makeSession(overrides: Partial & { title: string }): Sessi
}
const tipTrigger = (el: HTMLElement) => el.closest('[data-slot="tooltip-trigger"]')
-
const noop = vi.fn()
-
describe('SidebarSessionRow', () => {
+ it('collapses the actions track to zero width when idle (#75331)', () => {
+ const { container } = render(
+
+ )
+
+ const track = container.querySelector('[data-row-actions]')
+ expect(track).toBeTruthy()
+ // Idle: width-0 and opacity-0 keeps the row flush to the chat edge.
+ expect((track as HTMLElement).className).toMatch(/\bw-0\b/)
+ expect((track as HTMLElement).className).toMatch(/\bopacity-0\b/)
+ })
+
+ it('expands the actions track on row hover (#75331)', () => {
+ const { container } = render(
+
+ )
+
+ const row = container.firstElementChild?.querySelector('[data-row-actions]')?.parentElement
+ ?.parentElement as HTMLElement | null
+ expect(row).toBeTruthy()
+ // Simulate the parent group hover state — Tailwind's group-hover would
+ // only target the row's `group` ancestor in the real DOM. We assert that
+ // the cluster class list includes the hover-reveal contract.
+ const track = container.querySelector('[data-row-actions]') as HTMLElement
+ expect(track.className).toMatch(/group-hover:w-\[1\.375rem\]/)
+ expect(track.className).toMatch(/group-hover:opacity-100/)
+ // Fire a pointerenter to mirror the real interaction; the regression is
+ // caught statically above (CSS contract), this just exercises the
+ // pointer pipeline so a future refactor that drops the class hook fails.
+ // Mirror the real DOM hover contract: the track stays in the row, the
+ // parent
is the `group` ancestor for the
+ // Tailwind group-hover variants. The CSS contract is what guards the
+ // regression — Tailwind's `group-hover:` only resolves against an
+ // element actually marked `class="group"`, and our session-row.tsx
+ // passes that className on SidebarRowShell. We assert the *contract*,
+ // not JSDOM-applied styles (JSDOM doesn't resolve group-hover).
+ expect(track.getAttribute('data-row-actions')).not.toBeNull()
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ fireEvent.pointerEnter(row as HTMLElement)
+ })
+
it('keeps an aria-label on the kebab without wrapping it in a Tip', () => {
render(
+ // Hover-revealed actions cluster. Anchored to the right edge so the
+ // track only takes layout space while the kebab or the relative-age
+ // label is actually visible — no standing 22px gutter on idle rows
+ // (#75331). `group-data` ties the slot to row hover/focus so the
+ // track has zero width when the row is idle, growing only when
+ // interaction has telegraphs it. The kebab itself owns the hit
+ // target; the slot is purely a layout spacer.
+