fix(desktop): reserve chat action hover space

Message actions still fade in on hover and focus, but their row now keeps a stable height so transcript content does not jump when the pointer enters or leaves a message.

Constraint: Preserve the existing hover-only visibility and copy/fork interaction model.
Rejected: Keep animating height from zero | it causes the visible transcript reflow this change is fixing.
Confidence: high
Scope-risk: narrow
Tested: cd desktop && /Users/nanmi/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin/node ./node_modules/typescript/bin/tsc --noEmit
Tested: git diff --check -- desktop/src/components/chat/MessageActionBar.tsx desktop/src/components/chat/MessageList.test.tsx
Not-tested: Focused Vitest could not complete in this local shell because the Vitest/esbuild startup process stalled or reported esbuild service stopped.
This commit is contained in:
程序员阿江(Relakkes) 2026-05-31 23:01:46 +08:00
parent 0ab624bff4
commit fac8ffb0f2
2 changed files with 5 additions and 3 deletions

View File

@ -41,7 +41,7 @@ export function MessageActionBar({
<div
data-message-actions
data-align={align}
className={`pointer-events-none mt-0 flex h-0 w-full overflow-hidden opacity-0 transition-[height,margin-top,opacity] duration-150 group-hover:pointer-events-auto group-hover:mt-2 group-hover:h-7 group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:mt-2 group-focus-within:h-7 group-focus-within:opacity-100 ${
className={`pointer-events-none mt-2 flex h-7 w-full opacity-0 transition-opacity duration-150 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 ${
align === 'end' ? 'justify-end' : 'justify-start'
}`}
>

View File

@ -2743,8 +2743,10 @@ describe('MessageList nested tool calls', () => {
expect(assistantShell?.className).not.toContain('ml-10')
expect(userActions?.getAttribute('data-align')).toBe('end')
expect(assistantActions?.getAttribute('data-align')).toBe('start')
expect(userActions?.className).toContain('h-0')
expect(userActions?.className).toContain('group-hover:h-7')
expect(userActions?.className).toContain('h-7')
expect(userActions?.className).toContain('mt-2')
expect(userActions?.className).not.toContain('h-0')
expect(userActions?.className).not.toContain('group-hover:h-7')
expect(userActions?.className).not.toContain('invisible')
expect(within(userActions as HTMLElement).getByText('5m ago')).toBeTruthy()
expect(within(assistantActions as HTMLElement).getByText('2h ago')).toBeTruthy()