merge fix/617-panel-host-height into dev(#616 高度修复:面板宿主显式声明 height: 100vh,皮肤页级 filter/backdrop-filter 下不再塌成 0;只取贡献者 PR #617 的 CSS 那一半)
This commit is contained in:
commit
69eb35fb5f
2 files changed
+35
-1
No files matched your search
@@ -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 <body> 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
|
||||
|
||||
@@ -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 <body> 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\}/,
|
||||
|
||||
Reference in new issue
Block a user