From 85fa15a31528f082b01081fd66e7d504f12d657c Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Mon, 5 Oct 2026 21:46:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(panel-host):=20=E9=9D=A2=E6=9D=BF=E5=AE=BF?= =?UTF-8?q?=E4=B8=BB=E8=A1=A5=E6=98=BE=E5=BC=8F=20100vh=20=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=EF=BC=8C=E4=BF=AE=E6=8E=89=E7=9A=AE=E8=82=A4=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E5=9D=97=E4=B8=8B=E5=8F=B3=E4=BE=A7=E6=A0=8F=E6=95=B4?= =?UTF-8?q?=E6=9D=A1=E5=A1=8C=E9=99=B7=EF=BC=88#616=EF=BC=89?= 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 | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/client/sidebar.module.css b/src/client/sidebar.module.css index 35e955f3..37fbc38f 100644 --- a/src/client/sidebar.module.css +++ b/src/client/sidebar.module.css @@ -35,6 +35,19 @@ :global([data-dsh-panel-host]) { position: fixed; inset: 0; + /* Explicit viewport height — NOT a containing-block derivation (issue + #616). `inset: 0` alone sizes a fixed box from its containing block, and + a page-level `filter` / `backdrop-filter` / `transform` — exactly what a + glass skin puts on the shell wrapper or on itself — REPLACES that + containing block with the ancestor's own padding box. The shell's content + is itself fixed/viewport-sized, so that box is zero-height: the host + collapses to 0px and the whole native right sidebar goes invisible while + its DOM (and every panel in it) is fully present. `vh` is measured + against the viewport instead, so the height survives any ancestor's + containing-block games; the over-constrained triple (top: 0 + height + + bottom: 0) resolves by ignoring `bottom`, keeping this a top-anchored + viewport-height layer. */ + height: 100vh; z-index: 25; pointer-events: none; /* Clip at the viewport edge: collapsed panels slide off-screen with @@ -42,7 +55,8 @@ contributes to its ancestors' scrollable overflow — without this the hidden panels extended the document's scrollable area, making the whole page draggable left-right and up-down while any panel was collapsed. - The host is exactly viewport-sized (inset: 0), so the clip is invisible + The host is exactly viewport-sized (inset: 0 + the explicit 100vh + height above), so the clip is invisible until a panel slides in from the edge; internal scroll containers and the app's fixed overlay stack are unaffected. `clip`, not `hidden`: a hidden box stays a PROGRAMMATICALLY scrollable container, and a diff --git a/tests/panel-host-css.spec.ts b/tests/panel-host-css.spec.ts index 19da3785..cf2cc0bf 100644 --- a/tests/panel-host-css.spec.ts +++ b/tests/panel-host-css.spec.ts @@ -37,6 +37,26 @@ describe('panel host layer css', () => { expect(hostRule).toMatch(/inset:\s*0/) }) + it('pins an explicit viewport height, never a containing-block derivation (#616)', () => { + // `inset: 0` alone sizes a fixed box from its CONTAINING BLOCK, and a + // page-level `filter` / `backdrop-filter` / `transform` — exactly what a + // glass skin puts on the shell wrapper or on itself — REPLACES + // that containing block with the ancestor's own padding box. The shell's + // content is itself fixed/viewport-sized, so that box is zero-height: the + // host collapses to 0px and the entire native right sidebar goes + // invisible while its DOM (and every panel inside) is fully present. + // `vh` resolves against the viewport, so the explicit height survives the + // swap; `auto` / `100%` do not, which is what this pin rejects. + expect(hostRule, 'the [data-dsh-panel-host] rule must exist').toBeDefined() + const heights = stripComments(hostRule!).match(/(?:^|[;{])\s*height\s*:\s*[^;}]+/g) ?? [] + // Pin the WHOLE list, not the first hit: a second, later `height` + // (`auto` / `100%`) would win the cascade and silently restore the + // collapse. Sub-properties (`max-height`, `line-height`) do not match. + expect( + heights.map((declaration) => declaration.replace(/^[;{]\s*/, '').replace(/\s+/g, ' ').trim()), + ).toEqual(['height: 100vh']) + }) + it('does not reintroduce overflow on the degraded (absolute) layer', () => { const degraded = css.match( /:global\(\[data-dsh-panel-host\]\[data-dsh-panel-host-degraded\]\) \{([\s\S]*?)\n\}/,