fix(design): claim audit part 1 — a closing key no longer re-presses its trigger, the Switch box and name, named z-levels (E28)

- In-place editors (Playlists heading + rail rename, Plex collection + playlist rename, PriorityStepper,
  Scheduler interval): a real Enter closed the editor, returned the focus to the trigger, and the same
  keystroke's activation pressed that trigger again - re-opening the editor, or in the rail selecting
  the renamed playlist. useReturnFocus.arm(e) now cancels the key's default (type-enforced); the rail and
  Scheduler editors do the same. The earlier tests dispatched a synthetic keydown, which has no default.
- Plex playlist rename: an unchanged or empty title closes with no write, as the collection rename does.
- Switch: a 36x24 box around the track (the 24 floor), 44 on a coarse pointer; `label` is required, and
  the Plex two-way-sync switch had no name.
- z-index: numeric z-10/z-20 and a literal 40 moved onto the named layer scale; a lint rule + contract.
- The /watch file card's Download is the filled primary: the page's one action.
- Stale comments: the 1024x768 floor, the retired glass tuner.
This commit is contained in:
2026-09-25 02:25:54 +02:00
parent b4a6569d0d
commit 0521149cf1
25 changed files with 227 additions and 41 deletions
@@ -0,0 +1,29 @@
// @vitest-environment jsdom
//
// E28 audit: the Switch was a bare 36×20 track — under the 24 floor on a mouse, never the 44 touch box
// DESIGN.md A3 lists it under, and its name was optional, so the Plex-sync switch shipped nameless.
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { Switch } from "./form";
afterEach(cleanup);
describe("Switch", () => {
it("is a named switch whose own box meets the 24 floor and grows to the touch target", () => {
const onChange = vi.fn();
render(<Switch label="Dark mode" checked={false} onChange={onChange} />);
const sw = screen.getByRole("switch", { name: "Dark mode" });
expect(sw.getAttribute("aria-checked")).toBe("false");
expect(sw.className).toContain("h-6");
expect(sw.className).toContain("pointer-coarse:min-h-(--touch-target)");
fireEvent.click(sw);
expect(onChange).toHaveBeenCalledWith(true);
});
it("cannot be rendered without a name", () => {
// @ts-expect-error — `label` is required: a switch has no text of its own to be named by.
render(<Switch checked onChange={() => {}} />);
expect(screen.getByRole("switch")).toBeTruthy();
});
});