Skip to content
Toolkit

ADR-0019: An authored Studio component raises the contract it replaces

  • Status: Accepted
  • Date: 2026-08-19
  • Deciders: Renaissance workstream 002, phase 01 (DataTable); follows ADR-0018

Context

Workstream 002-renaissance authors the components the app has and Studio React lacks, then converts the call sites. Phase 01 has now produced four of them, and DataTable is the first where the app's version and the design system's rules disagreed.

The app's DataTable (apps/web/src/components/ui/DataTable.tsx, 213 lines, 14 call sites across 13 pages) is good code that breaks three Studio rules:

  • it renders no <caption>, where Studio's existing Table requires one and hides it visually — "tables need a caption; .visually-hidden is fine, absent is not" (studio/docs/for-developers/components.md);
  • its clickable rows are a <tr onClick> with no tabIndex and no key handler, so the row is a control only a mouse can reach — and DESIGN.md already says how a reachable one behaves: "Lists rove: item collections use roving tabindex — one tab stop per list, arrows move within it";
  • its loading state puts one role="status" region in every skeleton cell, so a six-row five-column table announces "Loading" thirty times.

Copying that faithfully into Studio would make the design system the place those defects live, and would spread them: the whole point of the move is that 82 files stop deciding this for themselves. But not copying it means conversion is no longer a mechanical import swap — a call site that never passed a caption now must.

The tempting third option is to accept the weaker contract now and tighten it "later, in a follow-up". This repository has the receipts on what later means: three shipped-but-dead subsystems on record in .archives/removal-safe/AUDITS-081226.md, a hand-copied token file that drifted for months, and two trackers that disagreed with each other and the code.

Decision

An authored Studio component implements the behaviour of the app component it replaces, and the contract of the design system it joins. Where the two conflict, the design system wins, and the difference is written down in the workstream's SESSION.md beside the authoring entry.

Concretely, for the component being authored:

  • Behaviour is a superset, never a subset. Every prop and state the app version supports keeps working, including the ones no current call site uses. A dropped behaviour is a regression, not a simplification.
  • The accessibility contract is Studio's, even where that adds a required prop. DataTable takes a required caption; makes onRowClick rows a keyboard list to DESIGN.md's own spec (one tab stop, arrows to move, Enter to open, X to toggle selection) rather than one tab stop per row; treats a click that landed on a control inside the row as that control's; names each select checkbox from rowLabel; announces the selection count; and marks its loading bars aria-hidden beneath the table's single aria-busy.
  • The looser call shape stays available where it costs nothing. rowKey and a column's cell are optional, falling back to row.id and row[id], so Studio's plain Table call shape still works and small tables do not pay for behaviour they do not use. Where the loose shape would be wrong it is refused rather than approximated: selection is identity, so a table with neither rowKey nor row ids gets no selection column instead of one keyed by position.
  • A raised contract is stated in the conversion notes, so the session that migrates the call sites finds out from the plan rather than from a failing build.

This is not licence to redesign. The charter's out of scope still holds: the workstream moves components to one source, it does not restyle them. What is in scope is the rules Studio already publishes — captions, focus, tokens, the interaction patterns — applied to code arriving from a place that did not have them.

Consequences

  • Conversion is a migration, not a find-and-replace. Phase 02 must budget for call-site edits per component, not just import rewrites. For DataTable that is 14 sites across 13 pages, plus a story, gaining a caption.
  • The app's version keeps working unchanged until its call sites move. Raising the contract in Studio does not touch components/ui, so the two can coexist for as long as conversion takes.
  • The parity gate cannot see any of this. check:studio-parity counts names, not contracts: it will call a component present whether or not it kept its behaviour. The superset rule is enforced by review and by the authoring session's own verification, which is weaker than a gate and is the reason the differences are written down.
  • Some raised contracts will be wrong. A required prop that turns out to be noise at 14 call sites is a mistake this ADR makes easier to make. The remedy is the same as everywhere else here: it is recorded, so it can be found and reversed.

Source: docs/decisions/0019-an-authored-studio-component-raises-the-contract-it-replaces.md

Library