Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(sidebar): 标题让位用占位,操作钮保持可聚焦
Dashe5dc478c1653
diff --git a/apps/desktop/src/renderer/__tests__/sidebarSessionTime.test.ts b/apps/desktop/src/renderer/__tests__/sidebarSessionTime.test.tsindex 72085e0d39..784be790de 100644--- a/apps/desktop/src/renderer/__tests__/sidebarSessionTime.test.ts+++ b/apps/desktop/src/renderer/__tests__/sidebarSessionTime.test.ts@@ -120,6 +120,10 @@ describe('SessionItem activity time', () => {expect(sessionItemSource).toContain('grid h-6 grid-cols-[max-content] items-center justify-items-end',);+ expect(sessionItemSource).toContain('absolute right-0 top-0 flex h-6 items-center gap-0.5');+ expect(sessionItemSource).toContain(+ 'pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100',+ );expect(sessionItemSource).toContain("'hidden group-hover:flex group-focus-within/slot:flex'");});});diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsxindex cb1cd185d3..851dcc5279 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx@@ -1291,40 +1291,56 @@ function TimeActionsSlot({)}{!archivePending && (- <div- className={cn(- 'col-start-1 row-start-1 h-[22px] items-center gap-0.5',- menuOpen ? 'flex' : 'hidden group-hover/card:flex group-focus-within/slot:flex',- )}- >- <CardAction- variant="list"- isActive={isActive}- label={t('ccAgent.sidebar.sessionMenu.moreActions')}- onClick={onOpenMenu}+ <>+ <div+ aria-hidden+ className={cn(+ 'invisible col-start-1 row-start-1 h-[22px] items-center gap-0.5',+ menuOpen ? 'flex' : 'hidden group-hover/card:flex group-focus-within/slot:flex',+ )}+ >+ <span className="size-5 shrink-0" />+ {(isArchived && canUnarchive) || canQuickArchive ? (+ <span className="size-5 shrink-0" />+ ) : null}+ </div>+ <div+ className={cn(+ 'absolute right-0 top-1/2 flex -translate-y-1/2 items-center gap-0.5',+ menuOpen+ ? 'opacity-100'+ : 'pointer-events-none opacity-0 group-hover/card:pointer-events-auto group-hover/card:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100',+ )}>- <EllipsisVertical size={14} strokeWidth={2} />- </CardAction>- {isArchived && canUnarchive ? (- <CardAction- variant="list"- isActive={isActive}- label={t('ccAgent.sidebar.sessionMenu.unarchive')}- onClick={() => onUnarchive()}- >- <Undo size={14} strokeWidth={2} />- </CardAction>- ) : canQuickArchive ? (<CardActionvariant="list"isActive={isActive}- label={t('ccAgent.sidebar.sessionMenu.archived')}- onClick={() => setArchivePending(true)}+ label={t('ccAgent.sidebar.sessionMenu.moreActions')}+ onClick={onOpenMenu}>- <Archive size={14} strokeWidth={2} />+ <EllipsisVertical size={14} strokeWidth={2} /></CardAction>- ) : null}- </div>+ {isArchived && canUnarchive ? (+ <CardAction+ variant="list"+ isActive={isActive}+ label={t('ccAgent.sidebar.sessionMenu.unarchive')}+ onClick={() => onUnarchive()}+ >+ <Undo size={14} strokeWidth={2} />+ </CardAction>+ ) : canQuickArchive ? (+ <CardAction+ variant="list"+ isActive={isActive}+ label={t('ccAgent.sidebar.sessionMenu.archived')}+ onClick={() => setArchivePending(true)}+ >+ <Archive size={14} strokeWidth={2} />+ </CardAction>+ ) : null}+ </div>+ </>)}</div></div>diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsxindex 33116bdcf2..9e98473532 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx@@ -1148,18 +1148,36 @@ export const SessionItem = memo(function SessionItem({- archived:More + Undo(lucide Undo),单击直接走 unarchive,不像 Archive 那样需要二次确认 pill(unarchive 非破坏性)。 */}{!archivePending && (- <div- // 入流而不是 absolute:hover 时槽变宽,标题自己 truncate,不会盖到字上。- // 不要同时写死 flex 又 hidden —— 同特异性下源码顺序会让 hidden 失效。- className={cn(- 'col-start-1 row-start-1 h-6 items-center gap-0.5',- menuPos !== null- ? 'flex'- : 'hidden group-hover:flex group-focus-within/slot:flex',- )}- >- {sessionActionButtons}- </div>+ <>+ {/* 入流占位只负责把标题挤窄;真正的按钮保持可聚焦,不能 display:none。 */}+ <div+ aria-hidden+ className={cn(+ 'invisible col-start-1 row-start-1 h-6 items-center gap-0.5',+ menuPos !== null+ ? 'flex'+ : 'hidden group-hover:flex group-focus-within/slot:flex',+ )}+ >+ {showAutomationRunAction ? <span className="size-5 shrink-0" /> : null}+ <span className="size-5 shrink-0" />+ {isArchived && !remoteWritesBlocked ? (+ <span className="size-5 shrink-0" />+ ) : canQuickArchive ? (+ <span className="size-5 shrink-0" />+ ) : null}+ </div>+ <div+ className={cn(+ 'absolute right-0 top-0 flex h-6 items-center gap-0.5',+ menuPos !== null+ ? 'opacity-100'+ : 'pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100',+ )}+ >+ {sessionActionButtons}+ </div>+ </>)}</div></div>diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.tsindex 00b0411c10..dc6f543ef6 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts@@ -331,13 +331,25 @@ describe('SessionCard review regressions', () => {);});- it('lets the title truncate by putting hover actions in flow instead of overlaying them', () => {+ it('lets the title truncate with an in-flow spacer while actions stay focusable', () => {+ expect(sessionItemSource).toContain(+ "'invisible col-start-1 row-start-1 h-6 items-center gap-0.5'",+ );expect(sessionItemSource).toContain("'hidden group-hover:flex group-focus-within/slot:flex'");+ expect(sessionItemSource).toContain('absolute right-0 top-0 flex h-6 items-center gap-0.5');+ expect(sessionItemSource).toContain(+ 'pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100',+ );expect(sessionItemSource).not.toContain('SESSION_ACTION_HOVER_SCRIM_CLASS');- expect(sessionItemSource).not.toContain('sessionActionScrimClass');+ expect(sessionCardSource).toContain(+ "'invisible col-start-1 row-start-1 h-[22px] items-center gap-0.5'",+ );expect(sessionCardSource).toContain("'hidden group-hover/card:flex group-focus-within/slot:flex'",);+ expect(sessionCardSource).toContain(+ 'absolute right-0 top-1/2 flex -translate-y-1/2 items-center gap-0.5',+ );expect(sessionCardSource).not.toContain('SESSION_ACTION_HOVER_SCRIM_CLASS');});