fix(ui): contain dropdown scroll geometry

This commit is contained in:
Codex
2026-08-05 18:29:19 +03:00
parent fac35cc23a
commit 07a42b8832
4 changed files with 20 additions and 2 deletions
@@ -1,4 +1,5 @@
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
import { computeFloatingPosition } from "../packages/ui-core/dist/index.js";
@@ -46,3 +47,15 @@ test("floating surface remains bounded when its anchor is below the viewport", (
assert.ok(position.top + Math.min(500, position.maxHeight) <= 712);
assert.ok(position.maxHeight <= 704);
});
test("dropdown scroll keeps portal geometry stable and contained", async () => {
const styles = await readFile(
new URL("../packages/ui-core/styles.css", import.meta.url),
"utf8",
);
const dropdownRule = styles.match(/\.nodedc-dropdown-surface \{(?<body>[\s\S]*?)\n\}/)?.groups?.body ?? "";
assert.match(dropdownRule, /box-sizing:\s*border-box;/);
assert.match(dropdownRule, /overflow:\s*auto;/);
assert.match(dropdownRule, /overscroll-behavior:\s*contain;/);
});