Files
siftlode/frontend/src/lib/touchTarget.contract.test.ts
T
peter 295c1db5f1 fix(design): claim audit part 1b — whole-row switches, the field-family edge, state-layer hovers, icon links, reason-disabled controls, 24/44 targets (E28)
- F12 (owner: A): SwitchRow, the whole settings row toggles; a Config boolean toggles from its title
  and hint (a label pointed at the switch).
- F14 (owner: B): the form dropdown trigger wears the field frame (see-through, the >= 3:1 edge);
  labelled pills keep the faint edge and the accent-edge hover. DESIGN says so, with log rows.
- F6: ~15 bg-card / bg-border / opacity hovers onto the B3 state layer; a lint rule (HOVER_SWAP)
  refuses the swap, contract-tested.
- F10: bare 14px icon links onto IconLink / LinkButton; a local lint rule refuses a glyph-only <a>.
- F13: reason-disabled controls are aria-disabled (Users, Channels backfill, Discovery, Scheduler
  runs, Config tests); FocusSafeButton now swallows the click of a caller's aria-disabled; the
  Config tests say why while dirty (testDirty, HU/EN).
- F5/F11: every control measured live at 24 (mouse) and 44 (coarse) across every page; touch-target
  is a utility that wins over a caller's min-h-6; link variants carry it too; SegmentedToggle,
  Tabs, NavRail, menu rows, PriorityStepper, sliders, CheckRow, InnerInput, card links and the rest.
- F9: DismissibleChip's label reaches the chip's 24; the Combobox chips are DismissibleChips.
- F15: the "+N" / "More..." open state worded as it renders.
2026-09-25 03:58:17 +02:00

23 lines
1.1 KiB
TypeScript

import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
// DESIGN.md A3: on a coarse pointer every control primitive is a 44 target. The E28 audit measured
// that it was not: `.touch-target` sat in @layer components, so a caller's own `min-h-6` (the mouse's
// 24 floor, a utility) beat it and the control stayed 24 on a tablet. jsdom does no cascade, so what is
// pinned is the rule's shape: a utility whose two minimums win over a sibling utility's.
const css = readFileSync(new URL("../index.css", import.meta.url), "utf8");
describe("the coarse-pointer target", () => {
it("is a utility whose minimums win on a coarse pointer", () => {
const block = /@utility touch-target\s*\{([\s\S]*?)\n\}/.exec(css)?.[1] ?? "";
expect(block).toContain("@media (pointer: coarse)");
expect(block).toMatch(/min-width:\s*var\(--touch-target\)\s*!important/);
expect(block).toMatch(/min-height:\s*var\(--touch-target\)\s*!important/);
});
it("is not also a component class that a utility would override", () => {
expect(css).not.toMatch(/\.touch-target\s*\{/);
});
});