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.
This commit is contained in:
@@ -156,17 +156,18 @@ describe("Button primitive (S5)", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("carries the coarse-pointer minimum target, except on a link", () => {
|
||||
it("carries the coarse-pointer minimum target and the 24 floor, a link variant too", () => {
|
||||
// The tablet comfort contract: the minimum lives in the primitive, so no call site can opt
|
||||
// out of it by accident. A link is text in a sentence and is excluded by design.
|
||||
// out of it by accident. A link variant was once excluded as "text in a sentence", but every
|
||||
// one stands alone, and the E28 audit measured them at 16–20px.
|
||||
const { unmount } = render(<Button>Tap</Button>);
|
||||
expect(screen.getByRole("button", { name: "Tap" }).className).toContain("touch-target");
|
||||
unmount();
|
||||
for (const variant of ["link", "link-muted"] as const) {
|
||||
const { unmount: u } = render(<Button variant={variant}>Read more</Button>);
|
||||
expect(screen.getByRole("button", { name: "Read more" }).className).not.toContain(
|
||||
"touch-target",
|
||||
);
|
||||
const cls = screen.getByRole("button", { name: "Read more" }).className;
|
||||
expect(cls).toContain("touch-target");
|
||||
expect(cls).toContain("min-h-6");
|
||||
u();
|
||||
}
|
||||
});
|
||||
@@ -223,6 +224,20 @@ describe("Button · disabled while it holds the focus", () => {
|
||||
active.mockRestore();
|
||||
});
|
||||
|
||||
it("keeps a caller's aria-disabled focusable and inert to a click (unavailable with a reason)", () => {
|
||||
const onClick = vi.fn();
|
||||
render(
|
||||
<Button onClick={onClick} aria-disabled>
|
||||
Run all
|
||||
</Button>,
|
||||
);
|
||||
const btn = screen.getByRole("button", { name: "Run all" });
|
||||
expect(btn.hasAttribute("disabled")).toBe(false);
|
||||
expect(btn.getAttribute("aria-disabled")).toBe("true");
|
||||
fireEvent.click(btn);
|
||||
expect(onClick).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("is natively disabled again once the focus is elsewhere", () => {
|
||||
render(
|
||||
<Button onClick={() => {}} disabled>
|
||||
|
||||
Reference in New Issue
Block a user