Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): keep the worker dialog scrim out of the window drag region (#5695)

Yunjin Zhangd272158b9754
diff --git a/apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx b/apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx
index e60b5cc130..09471cf724 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx
@@ -1,5 +1,5 @@
import * as Dialog from '@radix-ui/react-dialog';
-import { WINDOW_DRAG_STYLE, WINDOW_NO_DRAG_STYLE } from '@/components/layout/windowDrag';
+import { WINDOW_NO_DRAG_STYLE } from '@/components/layout/windowDrag';
import { Button } from '@/components/ui/button';
import { useModelPickerAgents } from '@/hooks/useAvailableAgents';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
@@ -653,7 +653,9 @@ export function CreateWorkerPopover({
<Dialog.Portal>
<Dialog.Overlay
className={cn('modal-scrim fixed inset-0 z-50 flex items-center justify-center', className)}
- style={WINDOW_DRAG_STYLE}
+ // 遮罩不是拖拽区:标 drag 会把整块视口变成拖拽命中区,只给 500px 的 Content 挖洞,
+ // 探出洞的浮层(模型面板)左侧就被吞掉 —— 与其它 modal 弹窗同口径(windowDrag.tsx)。
+ style={WINDOW_NO_DRAG_STYLE}
>
<Dialog.Content
className="modal-panel relative z-10 w-[500px] p-6 outline-none"
diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsx b/apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsx
index a8d737afbc..137242ad70 100644
--- a/apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/CreateWorkerPopover.test.tsx
@@ -1546,6 +1546,20 @@ describe('CreateWorkerPopover', () => {
);
});
+ it('keeps the modal scrim out of the Electron window drag region', () => {
+ // 遮罩标 drag = 整块视口都是拖拽命中区,只给 500px 的 Content 挖洞:模型选择器面板
+ // 按 align=end 贴 trigger、向左探出弹窗边框,探出部分被拖拽区吞掉(2026-10 实测:
+ // 左半点不动、左侧来源 rail 选不了)。同口径见 windowDrag.tsx。
+ render(<CreateWorkerPopover open onClose={vi.fn()} onCreate={vi.fn()} />);
+ const overlay = document.querySelector('.modal-scrim') as HTMLElement | null;
+ const panel = document.querySelector('.modal-panel') as HTMLElement | null;
+ const appRegion = (element: HTMLElement) =>
+ (element.style as CSSStyleDeclaration & { WebkitAppRegion: string }).WebkitAppRegion;
+ expect(overlay).not.toBeNull();
+ expect(appRegion(overlay!)).toBe('no-drag');
+ expect(appRegion(panel!)).toBe('no-drag');
+ });
+
it('does not wire provider navigation inside the detached sidebar window', async () => {
// 分离侧栏窗口固定 /sidebar-window 壳路由:本地 navigate 会把辅助窗口整壳替换
// 成主设置路由,与 OrcaWorkerPanel 的 settingsEnabled={!isSidebarWindow()} 同