Skip to content
Toolkit

ADR-0153 — A required field is marked by the field and announced by the control

Status: Accepted · Date: 2026-08-31 · Track: 002 close-out (LEDGER drain, row 48) · Supersedes: nothing · Builds on: ADR-0032, ADR-0035

Context

Field is Studio's only way to label a control: it renders the <label for>, generates the id, wires aria-describedby and aria-invalid, and hands the control what it must spread. It had no way to say a field was required — no prop, no rule, and no line in DESIGN.md's field anatomy — while pages/ carried 52 required attributes on controls that drew no marker at all.

The app has been in this state since ADR-0035 retired Form/FormField, whose · required suffix was the last marker anywhere. It had never agreed with the preview page, which drew an asterisk in a .field-label .req span; both are recorded in the preview file as prose, retired together, because no component the app shipped could reach either.

Decision

required is one statement on Field, and it does two things: it marks the field and it constrains the control.

<Field label="Email" required>{(a) => <Input {...a} type="email" … />}</Field>
  • The frame takes lk-field--required, which the component layer paints as content: ' *' in --error on the label's ::after.
  • The control receives required in FieldControlProps — the same bag that already carries id, aria-describedby and aria-invalid, spread at every call site. required?: true, absent rather than false, which is aria-invalid's shape one key over.

One statement, because a marker the control does not enforce and a constraint the label does not show are the two halves of one defect — and that defect is exactly what the app shipped: the constraint without the mark, on 52 controls.

The marker is painted, not written. A <span> in the <label> is a second text node inside it, so the label text becomes Email* — and the label text is what names the control. The first draft did write one, and two tests caught it immediately: getByLabelText('Slug') stopped finding its field. The same lookup is how the live specs address every form in this product (getByLabel), so a written marker would have been a rename of every required field's accessible name, discovered one E2E suite later. aria-hidden on the span would have answered a reader and not the lookups.

Consequences

  • The asterisk is decoration and the announcement is the control's: a reader speaks "required" because the input says so, not because a glyph is in the label.
  • It is not an error claim. An error is a border, a ring, a fill-weight icon and a message (DESIGN.md); this is one annotation in the same ink.
  • DESIGN.md's field anatomy states the marker and its painted-ness, so the three targets have one specification to answer.
  • The wiring is a sweep and this is its first surface. The auth pages — sign in, register, forgot password, nine fields — move their required from the control to the field in this commit, so the marker ships wired to something. The remaining ~42 sites are one ledger row, drained per surface like every other sweep on this track: a mark on some required fields and not others is a smaller wrong than a marker nothing reaches.
  • Marking the optional fields instead — the other convention, and the better one on a form where almost everything is required — stays a product decision. It would be a second prop and the same mechanism.

Source: docs/decisions/0153-a-required-field-is-marked-by-the-field-and-announced-by-the-control.md

Library