diff --git a/scripts/test-web-console-page-prefs.mjs b/scripts/test-web-console-page-prefs.mjs index 883d849..177c633 100644 --- a/scripts/test-web-console-page-prefs.mjs +++ b/scripts/test-web-console-page-prefs.mjs @@ -897,6 +897,48 @@ test("below 720 px the side list is a horizontal strip with no hints", async (t) await s.page.waitForFunction(() => document.getElementById("prefs-tabs").getAttribute("aria-orientation") === "vertical"); }); +// Every choice box in a looks row whose label overflows it, or that runs into the next box on its line. +async function crampedChoices(s) { + return s.page.evaluate(() => { + const bad = []; + for (const row of document.querySelectorAll("#prefs-panel-appearance .looks-row")) { + const boxes = [...row.querySelectorAll(":scope > label")]; + boxes.forEach((box, i) => { + const name = box.textContent.trim(); + if (box.scrollWidth > box.clientWidth + 1) bad.push(`${name}: its label overflows the box`); + const next = boxes[i + 1]; + if (!next) return; + const a = box.getBoundingClientRect(); + const b = next.getBoundingClientRect(); + if (Math.abs(a.top - b.top) < 2 && a.right > b.left + 1) bad.push(`${name}: runs into ${next.textContent.trim()}`); + }); + } + return bad; + }); +} + +test("with the Narrow card width in a wide window, no Appearance choice overflows or overlaps its neighbor", async (t) => { + noSavedLooks(t); + const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION }); + // Wide enough that no window-width rule applies: only the dialog is narrow. + await s.page.setViewportSize({ width: 1400, height: 900 }); + await s.page.click("#btn-looks"); + await s.page.locator("#looks-modal[open]").waitFor(); + await s.page.locator('input[name="looks-width"][value="narrow"]').check(); + await s.page.waitForFunction(() => document.documentElement.getAttribute("data-width") === "narrow"); + assert.deepEqual(await crampedChoices(s), []); + // The other widths stay clean too. + for (const width of ["comfortable", "wide", "ultrawide"]) { + await s.page.locator(`input[name="looks-width"][value="${width}"]`).check(); + // The default width leaves no attribute on the page. + await s.page.waitForFunction((w) => (document.documentElement.getAttribute("data-width") ?? "comfortable") === w, width); + assert.deepEqual(await crampedChoices(s), [], width); + } + // A small window still stacks the choices in one column, as before. + await s.page.setViewportSize({ width: 600, height: 800 }); + await s.page.waitForFunction(() => getComputedStyle(document.querySelector("#prefs-panel-appearance .looks-row.four")).gridTemplateColumns.split(" ").length === 1); +}); + test("Set your role on the dashboard opens on Appearance with agents and models loaded", async (t) => { fs.mkdirSync(HOME, { recursive: true }); fs.writeFileSync(LOOKS_FILE, JSON.stringify({ looks: { welcomeSeen: true, skillLaunched: true } })); diff --git a/src/web-console/public/styles/pieces.css b/src/web-console/public/styles/pieces.css index 3c158c3..ac820cc 100644 --- a/src/web-console/public/styles/pieces.css +++ b/src/web-console/public/styles/pieces.css @@ -826,6 +826,14 @@ h4.md-h, h5.md-h, h6.md-h { font-size: var(--fs-base); } .modal-ranges .sound-row label { flex: 1 1 100%; padding: 4px 5px; } .sound-row select { flex: 1 1 auto; min-width: 0; } } +/* In User Preferences the panel's own width decides too: at the Narrow card + width the dialog is narrow inside a wide window, where four choices side by + side squeezed "Comfortable" out of its box. Before the window rule below, so + a small window still stacks them in one column. */ +.prefs-panels { container-type: inline-size; container-name: prefs-panel; } +@container prefs-panel (max-width: 600px) { + .looks-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } +} @media (max-width: 720px) { .looks-row, .looks-row.four { grid-template-columns: 1fr; } }