Inspector on a short window: it scrolls, and its pickers' lists hang outside it
The panel stops 12px above the window's foot and scrolls (review on #106). Only where anchor positioning is supported: there the lists are fixed and anchored to their own boxes, as the phone strip's are, and the glass blur moves to a ::before so the panel is not their containing block. Elsewhere the panel keeps its height and clips nothing. i2.mjs gains a 300px-tall leg; seen to fail without the max-block-size, with absolute lists, and with the blur back on the panel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+83
−4
fixtures/engines/i2.mjs+34 −0internal/docs/fonts_engines_browser_test.go+2 −2internal/docs/views/show.html+47 −2
CI passed — run details
diff --git a/fixtures/engines/i2.mjs b/fixtures/engines/i2.mjs| index f984cc8..25988b2 100644 |
| --- a/fixtures/engines/i2.mjs |
| +++ b/fixtures/engines/i2.mjs |
| @@ -22,6 +22,8 @@ |
| // 6. 390px: the phone: the menus as the header's second row, the strip's |
| // undo/redo drawn and the lead's not. |
| // 7. 320px: no page-level horizontal overflow. |
| +// 8. A short window: the inspector scrolls inside it, and a picker's list |
| +// is not clipped by it. |
| // |
| // I2_SHOTS=<dir> also saves a screenshot of each leg there. |
| @@ -219,6 +221,38 @@ for (const engine of [chromium, webkit]) { |
| await context.close() |
| } |
| + // 8. A short window (review on #106): the inspector stops 12px above |
| + // the window's foot and scrolls, and a picker's list opened in it is |
| + // not clipped by it. |
| + { |
| + const { context, page } = await open(1280, 300) |
| + const g = await page.evaluate(() => { |
| + const el = document.querySelector('[docs-inspector]') |
| + const r = el.getBoundingClientRect() |
| + return { bottom: r.bottom, vh: innerHeight, scroll: el.scrollHeight, client: el.clientHeight, anchors: CSS.supports('anchor-name: --x') } |
| + }) |
| + if (g.anchors && !(g.bottom <= g.vh - 12 + 0.5 && g.scroll > g.client)) fail(`300px tall: the inspector ends at ${g.bottom} in ${g.vh} (scroll ${g.scroll}, client ${g.client}); want it inside the window, scrolling`) |
| + await page.click('#docs-select-font-combo') |
| + await page.waitForSelector('[docs-inspector] [rst-combo]:has(#docs-select-font-combo) [rst-combo-list]:not([hidden])', { timeout: 5000 }).catch(() => {}) |
| + const l = await page.evaluate(() => { |
| + const list = document.querySelector('[docs-inspector] [rst-combo]:has(#docs-select-font-combo) [rst-combo-list]') |
| + const box = document.querySelector('[docs-inspector]').getBoundingClientRect() |
| + const r = list.getBoundingClientRect() |
| + // A point of the list outside the inspector's box, if it has one. |
| + const ys = [r.bottom - 4, r.top + 4] |
| + const xs = [r.right - 4, r.left + 4] |
| + let outside = null |
| + for (const y of ys) for (const x of xs) { |
| + if ((y > box.bottom || y < box.top || x > box.right || x < box.left) && x >= 0 && y >= 0 && x < innerWidth && y < innerHeight) outside = outside || { x, y } |
| + } |
| + const hit = outside && document.elementFromPoint(outside.x, outside.y) |
| + return { list: { t: r.top, b: r.bottom, l: r.left, r: r.right, h: r.height }, box: { t: box.top, b: box.bottom, l: box.left, r: box.right }, outside, inList: !!(hit && list.contains(hit)), position: getComputedStyle(list).position } |
| + }) |
| + if (!l.outside) fail(`300px tall: the font list (${JSON.stringify(l.list)}) never leaves the inspector (${JSON.stringify(l.box)}): it is clipped by it, or select.js shrank it to the room the inspector leaves (both mean the panel is the list's clipping box)`) |
| + else if (!l.inList) fail(`300px tall: the font list is clipped where it leaves the inspector (${JSON.stringify(l)})`) |
| + await context.close() |
| + } |
| + |
| // 7. 320px: nothing overflows the page. |
| { |
| const { context, page } = await open(320, 720) |
diff --git a/internal/docs/fonts_engines_browser_test.go b/internal/docs/fonts_engines_browser_test.go| index e0ea07d..564b672 100644 |
| --- a/internal/docs/fonts_engines_browser_test.go |
| +++ b/internal/docs/fonts_engines_browser_test.go |
| @@ -112,11 +112,11 @@ func runEnginesApp(t *testing.T, script string) (string, *docs.App, error) { |
| names = []string{"simple"} |
| perName["simple"] = 2 * 4 |
| } |
| - // The I2 layout (i2.mjs): a fresh simple document per leg, eight legs |
| + // The I2 layout (i2.mjs): a fresh simple document per leg, nine legs |
| // per engine. |
| if script == "i2.mjs" { |
| names = []string{"simple"} |
| - perName["simple"] = 2 * 8 |
| + perName["simple"] = 2 * 9 |
| } |
| if script == "richer.mjs" { |
| names = []string{"simple", "empty"} |
diff --git a/internal/docs/views/show.html b/internal/docs/views/show.html| index ae51584..17732c2 100644 |
| --- a/internal/docs/views/show.html |
| +++ b/internal/docs/views/show.html |
| @@ -1369,8 +1369,6 @@ |
| background: |
| linear-gradient(light-dark(rgb(255 255 255 / 0.92), rgb(32 35 43 / 0.92)) 0 0) padding-box, |
| linear-gradient(var(--rst-line) 0 0) border-box; |
| - -webkit-backdrop-filter: saturate(1.4) blur(14px); |
| - backdrop-filter: saturate(1.4) blur(14px); |
| box-shadow: |
| inset 0 1px 0 light-dark(rgb(255 255 255 / 0.9), rgb(255 255 255 / 0.06)), |
| 0 2px 4px rgb(23 32 60 / 0.06), |
| @@ -1378,7 +1376,54 @@ |
| 0 28px 56px -20px light-dark(rgb(23 32 60 / 0.28), rgb(0 0 0 / 0.7)); |
| font-size: 13px; |
| } |
| + /* The glass's blur is drawn by a layer behind the panel's content, |
| + not by the panel: a backdrop-filter makes its element the |
| + containing block of every fixed descendant, and the pickers' |
| + lists below are fixed so that a scrolling panel cannot clip |
| + them. */ |
| + [docs-inspector][rst-box]::before { |
| + content: ""; |
| + position: absolute; |
| + inset: 0; |
| + z-index: -1; |
| + border-radius: inherit; |
| + -webkit-backdrop-filter: saturate(1.4) blur(14px); |
| + backdrop-filter: saturate(1.4) blur(14px); |
| + pointer-events: none; |
| + } |
| [docs-inspector][data-state="closed"] { display: none; } |
| + /* A short window (review on #106): the panel stops 12px above the |
| + window's foot and scrolls. Only where anchor positioning lets the |
| + pickers' lists hang outside it, fixed to the viewport and anchored |
| + to their own boxes, as the phone strip's are; elsewhere the panel |
| + stays as tall as it is and nothing in it is clipped. */ |
| + @supports (anchor-name: --docs-probe) { |
| + [docs-inspector][rst-box] { |
| + max-block-size: calc(100dvh - var(--estilo-bar-block-size) - 24px); |
| + overflow-y: auto; |
| + overscroll-behavior: contain; |
| + } |
| + [docs-inspector] [rst-combo]:has(#docs-select-block-combo) { anchor-name: --docs-select-block; } |
| + [docs-inspector] [rst-combo]:has(#docs-select-font-combo) { anchor-name: --docs-select-font; } |
| + [docs-inspector] [rst-combo]:has(#docs-select-size-combo) { anchor-name: --docs-select-size; } |
| + [docs-inspector] [rst-combo]:has(#docs-select-block-combo) [rst-combo-list] { position-anchor: --docs-select-block; } |
| + [docs-inspector] [rst-combo]:has(#docs-select-font-combo) [rst-combo-list] { position-anchor: --docs-select-font; } |
| + [docs-inspector] [rst-combo]:has(#docs-select-size-combo) [rst-combo-list] { position-anchor: --docs-select-size; } |
| + [docs-inspector] [rst-combo-list] { |
| + position: fixed; |
| + inset: auto; |
| + top: anchor(bottom); |
| + left: anchor(left); |
| + min-inline-size: anchor-size(width); |
| + inline-size: max-content; |
| + max-inline-size: calc(100vw - 2 * var(--rst-sp-2)); |
| + position-try-fallbacks: flip-inline; |
| + } |
| + [docs-inspector] [rst-combo][rst-combo-up] [rst-combo-list] { |
| + top: auto; |
| + bottom: anchor(top); |
| + } |
| + } |
| /* The font notes hang under the header as before; while the |
| inspector is open they stop short of it, so their dismiss button |
| is never under the panel. */ |