fix: 侧边栏全屏时自动收起底部工作台

This commit is contained in:
WinterXMQ committed 2026-11-20 23:09:51 +08:00
1 parent 8d48469aea
commit a5046aae12
2 files changed
+37

No files matched your search

+16
View File
@@ -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;
+21
View File
@@ -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"')
})
})