From a5046aae125bbcc29e459585a97b8e7fb064ed57 Mon Sep 17 00:00:00 2001 From: WinterXMQ Date: Fri, 20 Nov 2026 23:09:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E6=97=B6=E8=87=AA=E5=8A=A8=E6=94=B6=E8=B5=B7=E5=BA=95?= =?UTF-8?q?=E9=83=A8=E5=B7=A5=E4=BD=9C=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/sidebar.module.css | 16 ++++++++++++++++ tests/panel-host-css.spec.ts | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/client/sidebar.module.css b/src/client/sidebar.module.css index 4017663f..c205a649 100644 --- a/src/client/sidebar.module.css +++ b/src/client/sidebar.module.css @@ -234,6 +234,22 @@ visibility 0s linear var(--ds-transition-duration-slow); } +/* 宿主右侧栏全屏时,底部工作台不该浮在全屏面板前方:全屏面板铺满中心区, + 工作台凭自身 z-index 叠在上面,既破坏全屏整体感也挡住操作。宿主把全屏态 + 暴露在 panel 的 data-sidebar-right-panel="fullscreen"(普通态为 "push")。 + 用一条 body:has(...) 规则据此视觉收起:只改视觉、不动 store 的 bottomOpen, + 退出全屏即自动失效,工作台连同原展开状态一起恢复,无需记忆逻辑。 + :has() 在此是安全的——匹配的是宿主的 panel 属性,流式聊天不会改它,浏览器 + 的失效集合只在该属性变化时才重算,不像 layout.css 盯 #root 子树的那种用法。 */ +body:has([data-sidebar-right-panel="fullscreen"]) .bottomPanel { + transform: translateY(102%); + pointer-events: none; + visibility: hidden; + transition: + transform var(--ds-transition-duration-slow) var(--ds-ease-in-out), + visibility 0s linear var(--ds-transition-duration-slow); +} + /* Height drags write at pointer cadence; easing would detach the edge. */ .bottomPanel[data-dragging] { transition: none; diff --git a/tests/panel-host-css.spec.ts b/tests/panel-host-css.spec.ts index 6e87ff59..8910f2b2 100644 --- a/tests/panel-host-css.spec.ts +++ b/tests/panel-host-css.spec.ts @@ -159,3 +159,24 @@ describe('mermaid zoom modal surface css (issue #683)', () => { expect(viewport).toMatch(/cursor:\s*grab/) }) }) + +describe('bottom workbench vs host right-panel fullscreen', () => { + /** Body of the fullscreen-collapse rule, up to the un-indented closing brace. */ + const fullscreenRule = stripComments(css).match( + /body:has\(\[data-sidebar-right-panel="fullscreen"\]\) \.bottomPanel \{([\s\S]*?)\n\}/, + )?.[1] + + it('collapses the workbench while the host right panel is fullscreen', () => { + expect(fullscreenRule, 'a fullscreen-collapse rule must exist').toBeDefined() + expect(fullscreenRule, 'slide it off-screen').toMatch(/transform:\s*translateY\(102%\)/) + expect(fullscreenRule, 'make it non-interactive').toMatch(/pointer-events:\s*none/) + expect(fullscreenRule, 'hide it from view').toMatch(/visibility:\s*hidden/) + }) + + it('restores the original open state on exit by only changing visuals, never store state', () => { + // The rule is pure CSS: it never touches bottomOpen, so no remember/restore + // bookkeeping is needed and leaving fullscreen simply stops the rule applying. + expect(fullscreenRule).not.toMatch(/bottomOpen/) + expect(stripComments(css)).toContain('data-sidebar-right-panel="fullscreen"') + }) +})