fix(chat): keep toolbar background draggable (#1035)

This commit is contained in:
paisley
2026-05-18 17:54:38 +08:00
committed by GitHub
parent 566a2d752d
commit 4136b04c42
2 changed files with 27 additions and 10 deletions

View File

@@ -730,16 +730,19 @@ export function Chat() {
{/* Left column: chat */}
<div className="flex min-w-0 flex-1 flex-col">
{/* Toolbar */}
<div className="no-drag relative z-20 flex shrink-0 items-center justify-end px-4 py-2">
<ChatToolbar
questionDirectoryOpen={questionDirectoryVisible}
questionDirectoryCount={questionDirectoryItems.length}
onToggleQuestionDirectory={() =>
setQuestionDirectoryOpenSessionKey((openSessionKey) =>
openSessionKey === currentSessionKey ? null : currentSessionKey,
)
}
/>
<div className="relative flex shrink-0 items-center justify-end px-4 py-2">
<div data-testid="chat-toolbar-drag-region" className="drag-region absolute inset-0 z-0" aria-hidden="true" />
<div data-testid="chat-toolbar-actions" className="no-drag relative z-10">
<ChatToolbar
questionDirectoryOpen={questionDirectoryVisible}
questionDirectoryCount={questionDirectoryItems.length}
onToggleQuestionDirectory={() =>
setQuestionDirectoryOpenSessionKey((openSessionKey) =>
openSessionKey === currentSessionKey ? null : currentSessionKey,
)
}
/>
</div>
</div>
{/* Messages Area */}

View File

@@ -72,6 +72,8 @@ vi.mock('@/hooks/use-stick-to-bottom-instant', () => ({
useStickToBottomInstant: () => ({
contentRef: { current: null },
scrollRef: { current: null },
scrollToBottom: vi.fn(),
isAtBottom: true,
}),
}));
@@ -88,6 +90,18 @@ vi.mock('@/pages/Chat/ChatToolbar', () => ({
}));
describe('Chat artifact panel layout', () => {
it('keeps the chat toolbar background draggable while actions remain clickable', async () => {
window.electron.platform = 'darwin';
render(<Chat />);
const dragRegion = await screen.findByTestId('chat-toolbar-drag-region');
const actions = await screen.findByTestId('chat-toolbar-actions');
expect(dragRegion).toHaveClass('drag-region');
expect(actions).toHaveClass('no-drag');
});
it('layers the right artifact panel above the macOS drag strip', async () => {
window.electron.platform = 'darwin';