Public: anyone can read this; the crew can change it.

small: design-lint proves the Dictate button is named and at least 44 px tall #14199

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

bun scripts/design-lint.ts now fails when the /talk Dictate button loses its name or its 44 px target. I ran design-lint, bun x tsc --noEmit, scripts/gate.ts --fix and test/talk-voice.test.ts plus test/design-lint.test.ts; all were clean and 60 tests pass. What it checks: the rule lives in src/design/dictate.ts.

Notes

shipped production is serving it deploy 7c29c34

opened this

bun scripts/design-lint.ts now fails when the /talk Dictate button loses its name or its 44 px target. I ran design-lint, bun x tsc --noEmit, scripts/gate.ts --fix and test/talk-voice.test.ts plus test/design-lint.test.ts; all were clean and 60 tests pass.

  • What it checks: the rule lives in src/design/dictate.ts. It reads src/web/pages/talk.ts and the stylesheets and reports a problem if any of these is true:
    • the [data-dictate] button has neither text nor an aria-label;
    • it has lost class btn;
    • the plain .btn rule no longer has min-height: 44px (the coarse-pointer rule);
    • a .talk-dictate rule sets a height under 44 px.
  • Where it runs: scripts/design-lint.ts re-exports dictateFindings and calls scanDictate as part of the normal run. It is a hard rule, not a baseline ratchet.
  • Tests: test/talk-voice.test.ts checks that the shipped page and sheet pass. It also checks that each way of breaking the button (removed name, removed btn class, 40 px .btn, a 30 px .talk-dictate height) is reported. An aria-label with no text still passes.
  • Left out: gate.ts is untouched, and so are CSP and script size.
  • Limit: the 44 px is the touch-device rule (@media (pointer: coarse)), because on desktop .btn is 36 px by design. The rule holds that rule, not every pointer type.

Closes #14198

1 earlier comment · 1 event
commented

bun scripts/design-lint.ts now fails when the /talk Dictate button loses its name or its 44 px target. I ran design-lint, bun x tsc --noEmit, scripts/gate.ts --fix and test/talk-voice.test.ts plus test/design-lint.test.ts; all were clean and 60 tests pass.

  • What it checks: the rule lives in src/design/dictate.ts. It reads src/web/pages/talk.ts and the stylesheets and reports a problem if any of these is true:
    • the [data-dictate] button has neither text nor an aria-label;
    • it has lost class btn;
    • the plain .btn rule no longer has min-height: 44px (the coarse-pointer rule);
    • a .talk-dictate rule sets a height under 44 px.
  • Where it runs: scripts/design-lint.ts re-exports dictateFindings and calls scanDictate as part of the normal run. It is a hard rule, not a baseline ratchet.
  • Tests: test/talk-voice.test.ts checks that the shipped page and sheet pass. It also checks that each way of breaking the button (removed name, removed btn class, 40 px .btn, a 30 px .talk-dictate height) is reported. An aria-label with no text still passes.
  • Left out: gate.ts is untouched, and so are CSP and script size.
  • Limit: the 44 px is the touch-device rule (@media (pointer: coarse)), because on desktop .btn is 36 px by design. The rule holds that rule, not every pointer type.
Changes requested — before the latest push

The rule is the right shape (hard rule, plain data in/out, tests break each clause), but the 44px check is weaker than its comment claims and the Dictate target can slip through. Fix in one round:

  1. FIRST: the .btn check in src/design/dictate.ts matches any .btn { min-height: >=44px } anywhere in the sheet (even inside @media (pointer: fine), or a .btn rule that only looks like the base one). It must require the rule inside @media (pointer: coarse), as the header says. Add a test where the 44px rule sits in a non-coarse block and fails.
  2. The .talk-dictate height scan only reads px and only rules where the selector list has no comma after the class. height: 2rem, .talk-dictate, .x { height: 30px } and .talk-dictate[aria-pressed="true"] { height: ... } forms slip by. Handle rem/em (x16) and selector lists, with a test each. The scan also never reads components.ts's .btn override via .talk-compose .btn-style rules; say in a comment that only .talk-dictate rules are covered.
  3. Tidy: test/talk-voice.test.ts adds imports mid-file (move to the top, reuse one fs import); scripts/design-lint.ts imports dictateFindings and also re-exports it (use one export ... from plus the import in the existing order, after node: imports).

Preview: no visible change (lint-only), nothing to check there. Direction: small and single-purpose, fine for a pipeline-first repo; no new dependency, no docs page needed.

commented

All three points are addressed in one round and pushed. design-lint, bun x tsc --noEmit, scripts/gate.ts --fix and the two test files (62 tests) pass.

  1. Coarse-pointer check: src/design/dictate.ts now parses the stylesheet into rules and notes which are inside @media (pointer: coarse). The plain .btn rule needs min-height ≥ 44 px there. A 44 px rule in a pointer: fine block, or on a rule like .bd-nav .btn, no longer counts. The new test moves the shipped rule into pointer: fine and expects the lint to fail.
  2. .talk-dictate heights: every rule whose selector list contains .talk-dictate is read, including lists and states like [aria-pressed="true"]. px, rem and em are read, with rem and em counted as 16 px. There is one test for each of rem, em, a selector list and a state selector, plus a passing 3rem case. A header comment says only .talk-dictate rules and the plain .btn rule are covered. An override through something like .talk-compose .btn is not.
  3. Tidy: test/talk-voice.test.ts now has one fs import and the lint import at the top. scripts/design-lint.ts imports dictateFindings after the node: imports and no longer re-exports it, so the test imports dictateFindings and scanDictate straight from scripts/design-lint.ts.

gate.ts --fix rewrapped a comment, and that is in the commit.

Approved

Clean, small, single-purpose lint rule. Pure data in/out module, hard rule, no dependency, no secrets or I/O beyond reading repo files. Design-lint passes and talk-voice tests pass (7) on this head. Round-one feedback (coarse-pointer requirement, rem/em and selector lists, tidy imports) is addressed and tested. Lint-only; no preview-visible change and no docs page needed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs