Skip to content
Toolkit

ADR-0027: Two components, one name — when the ledger row points at the wrong component entirely, and a look is not a contract

Context

ADR-0026 established that a converting row in the parity ledger is a scheduling hint rather than a finding: the gate matches names, and Avatar was two different components that happened to share one. Its rule was diff the element, not only the props.

TabBar is that defect one step further out, and it breaks the rule's own assumption. ADR-0026's table compares two avatars — a <span> avatar and a <button> avatar, different elements but recognisably the same kind of thing. Here the two sides are not the same kind of control at all:

app components/ui/TabBar.tsxStudio TabBar (chrome.jsx)
Element<div role="tablist"> of <button role="tab"><nav class="lk-tabbar glass"> of <a>
What it isa tab strip fronting a form panelthe mobile bottom navigation bar
Selectionaria-selected, controlled by value/onChangearia-current="page", set by the route
Contenta text label per tab, optional icon and countone icon per item, name visually hidden
Where it rendersinside a drawer, on desktopdisplay: none above 720px
Stylesheet.segmented (app).lk-tabbar (40-shell-app.css)

The import swap the ledger row implies replaces three builder tab strips — in PwasPage, AdminThemesPage and LoginPage — with a navigation bar that renders nothing at all on the screens they live on. Every check in the phase-02 list passes while it happens: the props are not compared because the component takes different ones, the classes are all defined somewhere in Studio, and no gate here parses rendered markup.

The look was the trap, not the name

Studio does have the app's component. It is Segmented, in controls.jsx, and .lk-seg is visually almost exactly .segmented: a --surface-2 track with a hairline border, and a --surface fill with --shadow-flat on the active item. Having found that the names lied, the obvious move is to trust the pixels instead and convert TabBar onto Segmented.

That is also wrong, and it is wrong in the direction that is harder to see, because the result looks right on every screen:

Segmentedthe app's tab strip
Container rolerole="group"role="tablist"
Item statearia-pressedaria-selected
Panelnone — changes a view in placenames which panel is showing
Tab stopsone per segmentone for the whole strip
Arrow keysnone←/→ move and wrap, Home/End jump

A segmented control and a tab strip share a look and differ in their keyboard and announcement contract. Merging them behind a prop — role="tablist" when a panel is passed, say — would put one component and one stylesheet behind two accessibility contracts, and give consumers a way to get the wrong one by forgetting a prop. That is precisely the interactive-prop trap ADR-0026 rejected on Avatar, one level up: an inference that removes a failure mode must not ship with a way to opt out of it, and a component that can be either of two ARIA patterns has no guarantee to offer at all.

Where that leaves the phase-02 cost table

TabBar was the top row: three files, three uses. Measured on churn, that was exactly right — three files changed and three usages moved, as with Modal. Measured on work, it is the largest conversion since Avatar: a new component, a new component in the type surface, a new CSS family, an .lk-seg decision, and a call-site bug fix. The row was not merely imprecise; it named a component the work does not touch.

Decision

Three rules, all of them about reading the ledger row as a claim about components rather than about names.

1. When the two sides are different kinds of control, the conversion authors a new Studio component and the ledger row is a coincidence

Not a superset of either. Studio's TabBar keeps being the bottom nav — it has its own consumers in the shell demos and nothing about it is wrong — and the app's strip becomes Tabs + TabPanel, authored for it.

The test for "different kinds of control" is not similarity of appearance. It is whether one could stand in for the other at the other's call sites. A bottom nav cannot front a form panel in a drawer; a tab strip cannot be the mobile chrome. Where the answer is no in both directions, there is no superset to build, and pretending otherwise produces a component with two personalities and a prop to choose between them.

2. A shared look is not a shared component; a shared keyboard contract is

.lk-tabs is a new class family rather than a reuse of .lk-seg, and the duplication is deliberate and commented in the stylesheet. The rule this settles, because the visual near-identity will come up again:

Two controls belong to one component when a consumer swapping between them would change nothing a screen reader or a keyboard user can observe. Where the roles, the state attributes or the tab-stop model differ, they are two components that share a look, and the design system's job is to make them look alike — not to make them one thing.

The look is kept aligned by both families using the same tokens, which is what the token layer is for.

3. The panel association is a required, shared id — not a generated one

Tabs and TabPanel both take id, and it is required on both. The tempting alternative is a useId() default so the common case needs no prop; it is unusable here, because the two components would generate different ids and aria-controls / aria-labelledby would name nothing. An association that silently resolves to nothing is worse than an omitted one — it reads as wired in every review of the JSX.

This is ADR-0022's "prefer removing a failure mode to testing for it" in the form the type surface can enforce: id is not optional, so the association cannot be half-built. label is required for the same reason at one remove — a role="tablist" with no accessible name is announced as "tab list" and nothing else, and all three call sites shipped without one.

Consequences

  • The remaining six phase-02 rows get read as pairs of components before they are costed, per ADR-0026, with one addition: check that Studio's same-named export is even the same kind of control before diffing its props. TabBar is the second row in four to be a different component behind a matching name, after Avatar, and the first where the correct Studio counterpart is exported under a different name entirely.
  • The scoreboard is unchanged in shape and this is not a gate defect. The gate counts names because names are what it can read from source, and ADR-0026 already declined to have it guess at contracts. TabBar leaves the app's export surface, Tabs and TabPanel enter Studio's, and the ledger rows for TabBar are untouched because Studio's TabBar still exists and Swift still lacks it.
  • .lk-seg is left where it is, and it is the next instance of the ADR-0023 trap waiting to fire. It lives in 40-shell-app.css, which the component layer's two-file allowlist never reads, so it is absent from studio.components.css entirely: any future conversion onto Segmented ships an unstyled control. That is recorded on the session file rather than fixed here — Segmented has no app call site and moving its rules is not this item's work — and Tabs.test.tsx asserts the absence, so the reasoning stays checkable rather than becoming folklore.
  • Two dead things were found by writing the contract down. The app's count prop rendered <span class="chip-count">, whose only rule in the repository is .chip .chip-count — a descendant of a class this markup never emits — so it had never drawn anything; no call site passed one either. It is dropped rather than ported, which is ADR-0026's size precedent: a narrowing with a reason beats a superset with a surprise. And LoginPage kept the strip mounted after the password step handed off to 2FA, where it selected nothing and switching it to API Key made the Verify Code button post an empty API key instead of the code. A tab that controls no panel is the inert control non-negotiable #7 forbids; the strip is now hidden in that state.
  • onChange is required, which most Studio onChanges are not. The same reasoning one step further: a strip without one takes a tab stop, roves, swallows the arrow keys and changes nothing. Making it optional would have been ADR-0026's interactive prop again — shipping a way to produce a focusable control wired to nothing, and then documenting it.
  • A component in the standalone layer restates its own focus geometry. .lk-tabs__tab:focus-visible says border-radius again, because Cardsite's base.css sets a 6px radius on a bare :focus-visible at the same specificity and later in the cascade — the rule .lk-toggle already carries, and it bites harder here because selection follows focus, so the focused tab is always the filled one. It also takes a negative outline-offset: overflow-x: auto forces overflow-y to auto, so the strip is its own clipping scrollport and 3px of padding cannot hold a ring drawn outside the button. That second half is ADR-0025 answered from inside the component rather than from its ancestors — the clip that cut it was its own.
  • The i18n ratchet rises by three, and that is the right direction. label is required, so three previously-unnamed tablists gain an accessible name in a counted position — the Toggle conversion's +2 precedent exactly. The alternatives were to leave three strips unnamed or to hide the names in an expression the counter cannot read, and both trade a real defect for a flat number.

Source: docs/decisions/0027-two-components-one-name-and-the-conversion-that-is-an-authoring-job.md

Library