Stack User Preferences' card width choices two to a row when the dialog is narrow

AI Assisted
This commit is contained in:
Seth committed 2026-12-05 00:10:45 -08:00
1 parent 8b5932c351
commit 31edc2d5c9
2 files changed
+50

No files matched your search

+42
View File
@@ -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"); 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) => { test("Set your role on the dashboard opens on Appearance with agents and models loaded", async (t) => {
fs.mkdirSync(HOME, { recursive: true }); fs.mkdirSync(HOME, { recursive: true });
fs.writeFileSync(LOOKS_FILE, JSON.stringify({ looks: { welcomeSeen: true, skillLaunched: true } })); fs.writeFileSync(LOOKS_FILE, JSON.stringify({ looks: { welcomeSeen: true, skillLaunched: true } }));
+8
View File
@@ -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; } .modal-ranges .sound-row label { flex: 1 1 100%; padding: 4px 5px; }
.sound-row select { flex: 1 1 auto; min-width: 0; } .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) { @media (max-width: 720px) {
.looks-row, .looks-row.four { grid-template-columns: 1fr; } .looks-row, .looks-row.four { grid-template-columns: 1fr; }
} }