Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 修复文本预览 Tooltip 被遮挡 (#962)
Kmnyf39d98c2cda3
diff --git a/apps/desktop/src/renderer/__tests__/textLightbox.test.ts b/apps/desktop/src/renderer/__tests__/textLightbox.test.tsindex 0c6731e671..a1b8848189 100644--- a/apps/desktop/src/renderer/__tests__/textLightbox.test.ts+++ b/apps/desktop/src/renderer/__tests__/textLightbox.test.ts@@ -90,6 +90,19 @@ describe('TextLightbox — F3 overlay style', () => {it('overlay is rendered via createPortal to document.body', () => {expect(source).toMatch(/createPortal\(overlay,\s*document\.body\)/);});++ it('keeps every toolbar tooltip above the lightbox overlay', () => {+ expect(source).toMatch(/TEXT_LIGHTBOX_OVERLAY_Z_INDEX\s*=\s*9999/);+ expect(source).toMatch(+ /TEXT_LIGHTBOX_TOOLTIP_STYLE\s*=\s*\{[\s\S]*zIndex:\s*TEXT_LIGHTBOX_OVERLAY_Z_INDEX\s*\+\s*1/,+ );++ const tooltipContents = source.match(/<Tooltip\.Content\b/g) ?? [];+ const layeredTooltipContents =+ source.match(/<Tooltip\.Content\s+style=\{TEXT_LIGHTBOX_TOOLTIP_STYLE\}/g) ?? [];+ expect(tooltipContents.length).toBeGreaterThan(0);+ expect(layeredTooltipContents).toHaveLength(tooltipContents.length);+ });});// ── F4: toolbar wiring ──────────────────────────────────────────────────────diff --git a/apps/desktop/src/renderer/__tests__/toastZIndex.test.ts b/apps/desktop/src/renderer/__tests__/toastZIndex.test.tsindex 5ffb93c9f1..0dd889a297 100644--- a/apps/desktop/src/renderer/__tests__/toastZIndex.test.ts+++ b/apps/desktop/src/renderer/__tests__/toastZIndex.test.ts@@ -7,7 +7,7 @@* application uses 9999 as the "max" stacking layer for overlays (TextLightbox,* ImageLightbox, SplashScreen). To guarantee the Toast wins the z-index race* even when Modals + Lightboxes are stacked in document.body via Portals,- * ToastContainer is bumped one step higher to 10000.+ * ToastContainer is above the z-[10000] Radix Dialog layer at 10100.** Static-source scanning (matches the project convention used by* textLightbox.test.ts and imageLightboxCloseAnywhere.test.ts).@@ -33,16 +33,17 @@ const imageLightboxSource = readFileSync();describe('Toast z-index — sits above all overlays (symptom #1)', () => {- it('ToastContainer uses z-[10000] (one step above 9999 lightbox layer)', () => {- expect(toastContainerSource).toMatch(/z-\[10000\]/);- expect(toastContainerSource).not.toMatch(/z-\[9999\]/);+ it('ToastContainer class uses z-[10100] (above lightboxes and Radix dialogs)', () => {+ expect(toastContainerSource).toMatch(+ /className="[^"]*\bz-\[10100\][^"]*"/,+ );});it('TextLightbox overlay still uses zIndex 9999 (below toast layer)', () => {- // The lightbox sits at 9999; the toast sits at 10000. The strict ordering+ // The lightbox sits at 9999; the toast sits at 10100. The strict ordering// is what guarantees the Toast wins even when the Lightbox Portal mounts// later in document.body.- expect(textLightboxSource).toMatch(/zIndex:\s*9999/);+ expect(textLightboxSource).toMatch(/TEXT_LIGHTBOX_OVERLAY_Z_INDEX\s*=\s*9999/);});it('ImageLightbox overlay still uses zIndex 9999 (below toast layer)', () => {diff --git a/apps/desktop/src/renderer/components/chat/TextLightbox.tsx b/apps/desktop/src/renderer/components/chat/TextLightbox.tsxindex c3c2ff47ec..6a2c71dac7 100644--- a/apps/desktop/src/renderer/components/chat/TextLightbox.tsx+++ b/apps/desktop/src/renderer/components/chat/TextLightbox.tsx@@ -54,6 +54,10 @@ interface TextLightboxProps {// IPC response also carries `limitMb` so dynamic copy stays single-sourced.const OVERSIZE_LIMIT_MB = 10;const OVERSIZE_LIMIT = OVERSIZE_LIMIT_MB * 1024 * 1024;+const TEXT_LIGHTBOX_OVERLAY_Z_INDEX = 9999;+const TEXT_LIGHTBOX_TOOLTIP_STYLE = {+ zIndex: TEXT_LIGHTBOX_OVERLAY_Z_INDEX + 1,+} as const;/*** Format a byte count for display in the toolbar (`3.4 MB`, `812 KB`, `73 B`).@@ -373,7 +377,7 @@ export function TextLightbox({ filePath, fileName, initialLine, triggerRef, onClstyle={{position: 'fixed',inset: 0,- zIndex: 9999,+ zIndex: TEXT_LIGHTBOX_OVERLAY_Z_INDEX,background: 'var(--overlay-lightbox)',display: 'flex',flexDirection: 'column',@@ -467,7 +471,9 @@ export function TextLightbox({ filePath, fileName, initialLine, triggerRef, onCl)}</button></Tooltip.Trigger>- <Tooltip.Content>{t('chat.lightbox.clickToCopyPath')}</Tooltip.Content>+ <Tooltip.Content style={TEXT_LIGHTBOX_TOOLTIP_STYLE}>+ {t('chat.lightbox.clickToCopyPath')}+ </Tooltip.Content></Tooltip.Root>{/* Right — Show in folder + Copy content + Close (Open in System moved to Oversize CTA only). */}@@ -490,7 +496,7 @@ export function TextLightbox({ filePath, fileName, initialLine, triggerRef, onCl<Folder size={18} className="text-[var(--msg-tool-card-chevron)]" /></button></Tooltip.Trigger>- <Tooltip.Content>+ <Tooltip.Content style={TEXT_LIGHTBOX_TOOLTIP_STYLE}>{remoteOrigin ? t('chat.remoteFile.revealLocalCopy') : t('chat.lightbox.openInExplorer')}</Tooltip.Content></Tooltip.Root>@@ -511,7 +517,9 @@ export function TextLightbox({ filePath, fileName, initialLine, triggerRef, onCl<Copy size={18} className="text-[var(--msg-tool-card-chevron)]" /></button></Tooltip.Trigger>- <Tooltip.Content>{t('chat.textLightbox.copyAll')}</Tooltip.Content>+ <Tooltip.Content style={TEXT_LIGHTBOX_TOOLTIP_STYLE}>+ {t('chat.textLightbox.copyAll')}+ </Tooltip.Content></Tooltip.Root><Tooltip.Root><Tooltip.Trigger asChild>@@ -527,7 +535,9 @@ export function TextLightbox({ filePath, fileName, initialLine, triggerRef, onCl<X size={20} className="text-[var(--msg-tool-card-chevron)]" /></button></Tooltip.Trigger>- <Tooltip.Content>{t('chat.lightbox.close')}</Tooltip.Content>+ <Tooltip.Content style={TEXT_LIGHTBOX_TOOLTIP_STYLE}>+ {t('chat.lightbox.close')}+ </Tooltip.Content></Tooltip.Root></div></div>