From 39c8400421753fc714f239dc26b8701161af1320 Mon Sep 17 00:00:00 2001
From: paisley <8197966+su8su@users.noreply.github.com>
Date: Tue, 26 May 2026 13:00:34 +0800
Subject: [PATCH] fix: keep macOS artifact preview panel clickable above drag
region (#1067)
---
src/components/file-preview/ArtifactPanel.tsx | 18 ++++++++----
src/pages/Chat/index.tsx | 11 ++++++--
tests/e2e/mac-titlebar-drag-region.spec.ts | 6 +++-
tests/unit/artifact-panel.test.tsx | 28 +++++++++++++++++++
.../unit/chat-artifact-panel-layout.test.tsx | 10 +++++++
5 files changed, 65 insertions(+), 8 deletions(-)
diff --git a/src/components/file-preview/ArtifactPanel.tsx b/src/components/file-preview/ArtifactPanel.tsx
index 9db56afc..8ce4c124 100644
--- a/src/components/file-preview/ArtifactPanel.tsx
+++ b/src/components/file-preview/ArtifactPanel.tsx
@@ -17,11 +17,11 @@
* toolbar buttons, "View file changes →" links) can drive it.
*/
import { useLayoutEffect, useMemo, useRef } from 'react';
+import { cn } from '@/lib/utils';
import { Eye, FileEdit, FolderOpen, FolderTree, X } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { toast } from 'sonner';
import { Button } from '@/components/ui/button';
-import { cn } from '@/lib/utils';
import { supportsRichDocumentPreview, type GeneratedFile } from '@/lib/generated-files';
import { invokeIpc } from '@/lib/api-client';
import type { AgentSummary } from '@/types/agent';
@@ -44,6 +44,7 @@ export interface ArtifactPanelProps {
export function ArtifactPanel({ files, agent, runStartedAt, refreshSignal }: ArtifactPanelProps) {
const { t } = useTranslation('chat');
+ const isMac = window.electron?.platform === 'darwin';
const tab = useArtifactPanel((s) => s.tab);
const setTab = useArtifactPanel((s) => s.setTab);
const focusedFile = useArtifactPanel((s) => s.focusedFile);
@@ -61,9 +62,16 @@ export function ArtifactPanel({ files, agent, runStartedAt, refreshSignal }: Art
};
return (
-
+
-
+ {isMac && (
+
+ )}
+
{richFocusedFile ? (
@@ -110,7 +118,7 @@ export function ArtifactPanel({ files, agent, runStartedAt, refreshSignal }: Art
-
+