From 8e2df5544a93c1ab0bb8253e96791625714ae505 Mon Sep 17 00:00:00 2001 From: Knotty Wyvern Date: Sat, 31 Oct 2026 17:33:07 -0700 Subject: [PATCH] Show the label colors in Manage labels again The default field rule of Project Management excluded the find bar with :not(.rs-find-bar input). That exclusion raised the specificity of the rule above the rule of each control. Thus the color swatches, the card title field, the switches, and the date field got the default field background. :where() inside :not() keeps the exclusion and adds no specificity. A new smoke test checks the 16 swatch colors and the card title field in both themes. Card 0efb6b6e. --- src/lib/features/pm/ui/style.css | 7 ++-- tests/smoke/features/pmLabelColors.smoke.mjs | 38 ++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 tests/smoke/features/pmLabelColors.smoke.mjs diff --git a/src/lib/features/pm/ui/style.css b/src/lib/features/pm/ui/style.css index 32d634f..43563bb 100644 --- a/src/lib/features/pm/ui/style.css +++ b/src/lib/features/pm/ui/style.css @@ -67,7 +67,7 @@ cursor: default; } .rs-pm button:not(.rs-picker-row):not([role^="menuitem"]):focus-visible, -.rs-pm input:not(.rs-find-bar input):focus-visible, +.rs-pm input:not(:where(.rs-find-bar input)):focus-visible, .rs-pm select:focus-visible, .rs-pm textarea:focus-visible { outline: 1px solid var(--pm-accent); @@ -196,7 +196,8 @@ .pm-search-row input { width: min(340px, 100%); } -.rs-pm input:not(.rs-find-bar input), +/* The find bar exclusion adds no specificity, so the rules of each control can replace these defaults. */ +.rs-pm input:not(:where(.rs-find-bar input)), .rs-pm select, .rs-pm textarea { background: var(--pm-field-surface); @@ -205,7 +206,7 @@ padding: 6px 8px; min-height: 30px; } -.rs-pm input[type="checkbox"]:not(.rs-find-bar input) { +.rs-pm input[type="checkbox"]:not(:where(.rs-find-bar input)) { min-height: 0; width: 16px; height: 16px; diff --git a/tests/smoke/features/pmLabelColors.smoke.mjs b/tests/smoke/features/pmLabelColors.smoke.mjs new file mode 100644 index 0000000..710d324 --- /dev/null +++ b/tests/smoke/features/pmLabelColors.smoke.mjs @@ -0,0 +1,38 @@ +// Project Management label colors: each color choice of Manage labels shows its color, and the card title keeps its own field style, in both themes. +import assert from "node:assert/strict"; +import path from "node:path"; +import { outputDir, runSmoke } from "../_harness/index.mjs"; +import { loadWorkspace, openBoard, pane, setTheme } from "../_harness/pmFixture.mjs"; + +const rgb = hex => `rgb(${hex.slice(1).match(/../g).map(value => parseInt(value, 16)).join(", ")})`; + +await runSmoke("features/pmLabelColors", async ({ page }) => { + const output = await outputDir("features/pmLabelColors"); + await loadWorkspace(page); + await openBoard(page, "Roadmap"); + await pane(page).locator(".pm-card-title", { hasText: /^Card A$/ }).click(); + const editor = page.locator("dialog.pm-card-editor[open]"); + await editor.waitFor(); + + // The card title is a transparent field. The default field rule of Project Management does not replace its background. + const title = editor.getByRole("textbox", { name: "Title", exact: true }); + assert.equal(await title.evaluate(input => getComputedStyle(input).backgroundColor), "rgba(0, 0, 0, 0)"); + + await editor.getByRole("group", { name: "Card details", exact: true }).getByRole("button", { name: "Labels", exact: true }).click(); + await page.getByRole("dialog", { name: "Choose labels", exact: true }).getByRole("button", { name: "Manage labels", exact: true }).click(); + const manager = page.getByRole("dialog", { name: "Manage labels", exact: true }); + await manager.waitFor(); + const bug = manager.getByRole("group", { name: "Label Bug", exact: true }); + const swatches = await bug.locator("input.pm-color-swatch").evaluateAll(inputs => + inputs.map(input => ({ name: input.getAttribute("aria-label"), color: input.style.getPropertyValue("--pm-swatch-color"), shown: getComputedStyle(input).backgroundColor }))); + assert.equal(swatches.length, 16); + for (const swatch of swatches) assert.equal(swatch.shown, rgb(swatch.color), `${swatch.name} shows its color`); + + await bug.getByRole("radio", { name: "Blue", exact: true }).check(); + await manager.locator(".pm-label-badge", { hasText: /^Bug$/ }).waitFor(); + for (const theme of ["dark", "light"]) { + await setTheme(page, theme); + await bug.screenshot({ path: path.join(output, `label-colors-${theme}.png`) }); + } + console.log("PASS: label color choices and the card title field"); +});