Skip to content

Measure links, text inputs and dialog buttons at 44px on a phone - #260

Merged
vicmaster merged 6 commits into
masterfrom
phase-32-slice-e
Nov 23, 2026
Merged

vicmaster merged 6 commits into
masterfrom
phase-32-slice-e

Conversation

@vicmaster

Copy link
Copy Markdown
Owner

Phase 32 slice E (docs/specs/PHASE-32-SPEC.md, FR-E1 to FR-E3, with the contracts pinned in the spec's R1 to R9 block and both verify rounds recorded after it).

The problem

On a canvas declared mobile, the 44px touch rule (mobile-touch-target) measured the four controls and the phone primitives only. A link, a text-input, a modal's close button and actions, and a toast's action were measured at no floor at all, so a 32px field or a 24px "Undo" passed and canvas_evaluate said READY. A text-input had no 44px size, and a modal or toast had no way to reach 44, so the docs sent every phone dialog to sheet.

What changed

  • text-input takes size: "lg", 44px tall. sm stays 32 and md 40. A multi-line field is still rows × 20 + 12.
  • modal and toast take controlSize. It uses the button size names and heights (xs 24, sm 32, md 44, lg 52). On a modal it sizes the close button (a square) and every action; on a toast, the action. The defaults are today's sizes (sm on a modal, xs on a toast), and any other value, including inherited names such as constructor, falls back to them. Without controlSize a modal and a toast render byte-identical to before, on every type. size on a modal still means its width.
  • The phone rule measures all of them at 44. A link, a text-input, each modal control and a toast's action is one mobile-touch-target error when it is below 44, with a suggestion naming the fix (height: 44, size: "lg", controlSize: "md"). Disabled targets count, as disabled buttons already did on a phone. A link or text-input beside a control means the control no longer owns its row. Web and desktop-app keep their 24px rule unchanged.
  • The docs stop sending every phone dialog to sheet. A centred modal with controlSize: "md" is a valid phone dialog; sheet stays the choice for a panel that rises from the bottom. A link inside a sentence stays a text node's links range, which is exempt.

Decisions the spec text did not settle

  • A link with a numeric height is never narrower than tall, as a button already is. Before this, a link with height: 44 and a short label ("Edit") rendered about 26px wide and the rule passed it, because the link's width was unknown. It now renders min-width equal to its height and centres its label when it sets no width. A link without a numeric height renders exactly as before. A layout that gave a link a width smaller than its height moves.
  • A size below the floor never prints as the floor. A 43.5px target used to read "44×44px … below the 44px floor". Such a value now prints with one decimal; every other message is unchanged.

Verdicts that moved

Test Before Now
test/unit/test-desktop-primitives.ts Pinned that a link on a phone raises no touch finding. A 24px link is an error on a phone; a nav-item still is not measured there.

No mobile realisation uses a link, text-input, modal or toast, so the mobile pattern gate and the Ridgeline run are unchanged and pass. On web and desktop-app a link with a numeric height under 24 and a narrower width now passes the 24px floor, since it renders 24 wide.

Not fixed here

  • Each primitive is judged by its props, not the box it ends up with. A link stretched taller by its row, or by a large fontSize, still measures its height, so it errors until height: 44 is set. A text-input's fluid width ("10%") is not judged. The docs say so.
  • A link with height: 44 inside a parent narrower than 44 overflows it, and nothing reports that.

Tests

  • New test/unit/test-phone-targets.ts: every FR-E1 to FR-E3 acceptance on a phone, each passing case with a failing twin, the fallbacks for invalid controlSize, the row rule, disabled targets, the exact suggestions, and web and desktop-app untouched.
  • test/unit/test-overlays.ts: byte-identity against the pre-slice render on web, mobile and desktop-app, and the 44px markup at controlSize: "md". test/unit/test-desktop-primitives.ts: lg, and the link's min-width with its twins.
  • test/browser/test-overlays-render.ts: the modal's and toast's controls measured in Chrome at 32/24 and at 44. test/browser/test-desktop-primitives-render.ts: short links at height: 44 render 44 wide; a link without a height still hugs its label.
  • Full tier 150/150 on 551f8e1; type check of the tests is clean.

A phone canvas never measured a link, a text-input, a modal's buttons or a
toast's action, so a 32px field passed silently. text-input gains size lg
(44) and modal and toast gain controlSize (the button size names); the
mobile-touch-target census measures all four.
A short labelled link at height 44 rendered 26px wide and the phone census
passed it, since its width was unknown. Verify round 1 fixes and docs.
@vicmaster
vicmaster merged commit c73ab67 into master Nov 23, 2026
3 checks passed
@vicmaster
vicmaster deleted the phase-32-slice-e branch November 23, 2026 14:18
@vicmaster vicmaster mentioned this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant