Skip to content
Toolkit

ADR-0032: One app Input, four Studio jobs — the largest conversion splits by job, not by field

Context

Input was the largest surface in the workstream: 56 files, 303 uses — and the cheapest census in it, because every one of the 303 is statically visible. Zero {...spread} sites, zero refs, zero explicit ids, zero aria-labels. What the JSX says is everything there is.

ADR-0029 predicted this conversion would be its shape in the other direction — one app export against more than one Studio export — and said to run the check anyway. The check came back wider than the prediction. Textarea had established the two-way split (the app's export is one per field, Studio's one per job: wrapper vs control). Input splits four ways, because the app component was doing two more jobs the props hid:

JobWhere it hidCountStudio counterpart
Label + message + wiringlabel/helper/error props271 / 10 / 7Field (existing)
The bare controleverything else—Input (existing)
Password revealimplied by type="password"16 sites (13 static, 3 computed)PasswordInput (authored here)
Toolbar searchicon={<Search/>} + placeholder11 magnifier sitesSearchField (existing, raised)

Two of those jobs could not be an import swap:

  • The reveal. The app drew an Eye/EyeOff toggle inside every password field — real, used behaviour on the auth pages, settings, and the admin credential forms. Studio had nothing: no trailing-adornment slot, no eye glyph (an unexported eye-slash in resource.jsx was half of one). Dropping it would ship a regression on 16 sites; keeping it app-side would fork the design system. Non-negotiable #2 decides this: the component is built in studio/.
  • The search. SearchField existed and was the right kind — but its magnifier was ph ph-magnifying-glass, an icon-font class Studio ships no font for, so adopting it as-was would put a blank space where 11 toolbars currently draw a lucide magnifier. The open-item-4 discipline (fix each module's ph-* as its component converts, never speculatively) lands on SearchField exactly here.

What the census showed the props were hiding

  • 29 icon sites, two populations. Eleven are magnifiers on unlabeled toolbar searches — that is SearchField's job description. The other eighteen are decorative leading glyphs (Mail, Lock, Key, User, Globe, Globe2, ExternalLink) on labelled form fields, mostly auth. DESIGN.md's field anatomy — label[for] → control → helper — has no leading glyph on a labelled control; the magnifier belongs to the search pill alone. The eighteen do not survive — the larger of this conversion's two deliberate visual changes (ADR-0029's dot, in reverse). The second is additive: seven placeholder-only searches that never had a magnifier gained the full search treatment — pill radius, drawn magnifier, type="search" — because they are searches by function and Studio's pill is what a search is, which is also what finally names them. The one placeholder-only site left as a bare Input is AdminResourcesPage's toolbar field, on purpose: it toggles between filter and search semantics with the active tab, and a permanent search pill would lie in filter mode.
  • 32 uses had no accessible name at all — placeholder-only searches and filters, AdminFeatureFlagsPage's four create-form fields (two of them required), two password-capable mapped credential inputs, and one DataTable-cell input with no name and no placeholder. Every conversion touching a control has found this defect; at 303 controls this was the largest instance. All 32 now have a name — SearchField.label (which defaults, because an unnamed control is a bug, not an option) or aria-label.
  • The reveal was keyboard-unreachable. tabIndex={-1} on the toggle meant a sighted keyboard user could never check what they typed. PasswordInput's button is a real tab stop, named, re-named as it flips, type="button" so it cannot submit the form it sits in.

Decision

The 303 uses convert to four components by job: Field + Input for labelled fields (helper → help, error moves to Field), PasswordInput for every site that is a password field (including the three computed type={cond ? 'password' : 'text'} sites, which branch), SearchField for the unlabeled toolbar searches, bare Input + aria-label for the rest.

PasswordInput is authored in Studio, not kept app-side: a bare password input plus its reveal, type deliberately not a prop (the component is the type — Omit<…, 'type'> in PasswordInputProps, and the runtime spreads rest first so a passed type loses). The eye glyphs are drawn inline (ADR-0024). CSS: .lk-password pads the control right by the button's footprint the way .lk-search pads left, and the button restates its focus radius — the fourth instance of the base.css :focus-visible trap.

SearchField is raised, not adopted as-was (ADR-0019): the magnifier became a drawn svg.lk-icon, .lk-search i widened to .lk-search i, .lk-search > .lk-icon (the i selector stays for the vanilla HTML demos), and it gained a type. .lk-input--mono joined the layer as .lk-textarea--mono's single-line counterpart for the two className="mono" sites.

The types landed first (Method step 3): InputProps, PasswordInputProps, SearchFieldProps in index.d.ts, closing the slot the workstream had deliberately reserved ("Input is knowingly among them" — ADR-0029). Badge is now the only deliberately untyped export.

Consequences

  • The parity gate goes from 3 awaiting conversion to 2: Button and Card remain. The React export count rises by one (PasswordInput), with a Swift disposition recorded like Field's.
  • Eighteen decorative leading icons disappear from auth and settings fields, and seven toolbar searches gain the magnifier pill they never drew — the two deliberate visual changes, both toward what DESIGN.md specifies. The fields keep their labels, placeholders and (for passwords) the reveal.
  • Two label treatments end. The thirteen pages that mixed label.field-label (app) with .lk-field > label (Studio) now render one treatment; .field-label's remaining emitters are Form.tsx and Select.tsx, whose conversions retire it.
  • The ADR-0021 sweep, counted: .control is still emitted by 44 files (62 className positions) beyond Input.tsx — SESSION.md's "~49" was measured over string literals, not markup — .field 8, .is-invalid 7, .control-icon 3, .field-label, .hint, .control-wrap, .has-icon at least one each — all stay. Deleted: .control-wrap > .control-icon.is-trailing, its button rule, and .control-wrap.has-trailing > .control — Input.tsx was their only emitter in the repository.
  • The i18n ratchet moves and the baseline records why: nine helper literals became help (a counted attribute), and the accessible-name fixes added counted aria-label/label literals. The error attribute joins TEXT_ATTRIBUTES; today it contributes zero, because all seven production error values are state identifiers, not literals.
  • PasswordInput's reveal strings ('Show password'/'Hide password') move into studio/packages/react, which the counter does not yet scan — already recorded as open item 8.
  • Three sites the census flagged stay untouched, as open items, because fixing them here would be the adjacent cleanup the routine forbids: the two unlabeled/overridden controls the Badge census recorded near its call sites (LinksPage and NotificationHandlersPage, per the open-items ledger) and the QR builder's hand-rolled ColorInput (input.control is-mono), which is ColorPicker's authoring problem, not this conversion's.

Verification

npm run verify exits 0. The behavioural test is apps/web/src/components/Input.test.tsx (14 tests); three mutations were watched biting before the assertions were trusted — the .lk-password .lk-input padding rule deleted from the built layer, the reveal pushed back out of the tab order, and the magnifier reverted to its ph-* class — each failing exactly one test, and the suite restored to green after each. Layer assertions parse rules and match exact selectors (the Textarea.test.tsx discipline), against studio.components.css — the layer the app imports, not studio.css.

Source: docs/decisions/0032-one-input-four-studio-jobs.md

Library