Skip to content
Toolkit

ADR-0034: The card whose every difference was not a prop — what a two-prop conversion hides

Context

Nineteen conversions built a checklist, and every one of them earned its step by being surprised at it. ADR-0026: the same name can be two elements. ADR-0027: two kinds of control. ADR-0032: one export doing four jobs. ADR-0033: 287 uses, six variants, three words that changed meaning. The checklist those produced is a prop-diffing procedure — identify the counterpart, diff the props, count what is reachable, check the layer, check the container.

Card passes every step of it in about ten minutes, because it has two props:

app components/ui/Card.tsxStudio Card (surfaces.jsx)
Elementdiv, alwaysas, default div
Frame.card — --surface, 0.5px --outline, --r-lg, --shadow-flat.lk-card — --surface, 0.5px --border, --r-lg, --shadow-flat
Paddingpadding: 'none' | 'sm' | 'md' | 'lg', default mdflush, else --space-6
Lifthover → .card.is-interactivehover → .lk-card--hover
Radius step—size="xl"

--outline is var(--border) through the app's alias bridge, so the frame row is not even a difference. Two props, one of which maps by name and one of which has an obvious near-match. The whole conversion looks like an import swap and a rename, and the parity ledger — which matches names across three targets — has said Card | yes | yes | converting for the entire workstream.

Three things changed on all 191 call sites, and not one of them is in that table, because not one of them was a prop.

1. padding was an inline style, so there is no size axis to port

const paddingStyles = { none: undefined, sm: 'var(--space-4)',
                        md: 'var(--space-5)', lg: 'var(--space-8)' }
// …
<div className={…} style={{ padding: paddingStyles[padding], ...style }} />

Every one of the 191 cards carried its gutter as an inline style. AGENTS.md §3 forbids exactly that, and this is the second time the workstream has met it: ADR-0029 records that Badge's size "drew height:22; padding:0 9px; fontSize:10.5 as an INLINE STYLE on 29 of the 61 uses… that is the reason there is no size axis to port." The same sentence applies here at 191 of 191.

So padding does not become a Studio prop. It becomes two facts:

  • padding="none" is flush, at 56 sites, and the mapping is exact rather than approximate for the reason in §2.
  • The other 135 take Studio's single gutter, --space-6 — 20px → 24px at 131 of them, including the 6 that asked for sm (16px, 2 sites) or lg (32px, 4 sites). A 16px card and a 32px card are a size, and Studio's card does not have one.

And at the other 4 the gutter does not become 24px, for a reason that is the same finding running the other way. AdminUsersPage, AdminNotificationsPage and AdminTaxImportPage (×2) render <Card className="alert is-…">, and .alert declares padding: var(--space-3) var(--space-4). It is (0,1,0), the same weight as .lk-card, and apps/web/src/styles/components.css is imported after @studio/core/css/components, so it wins. It could never win before: the component's padding was an inline style, which no class can outrank. So those four cards were already wearing .alert's border, background and radius while keeping a 20px gutter that .alert had been trying to set to 12px/16px the whole time — and moving the padding off the style attribute and into a class is exactly what let the rule they already carried finish the job. The inline style was not only forbidden spacing; it was masking a rule the same element declared.

2. overflow: hidden was unconditional here and is flush-only there

.card       { …; overflow: hidden; }          /* app — all 191 */
.lk-card--flush { padding: 0; overflow: hidden; }   /* Studio — only flush */

This is the row that is not in any table anywhere, because it is not a property of the component in either direction — it is a declaration one stylesheet makes and the other does not, on a class the call site never names. An import swap changes the clipping behaviour of 191 cards and the JSX is byte-identical before and after.

It also settles §1's mapping. padding="none" could have been read as "I want no gutter" and answered with flush, or with a padding: 0 utility, and the two are not the same: flush clips. Reading the 56 sites decides it — 47 hold a table, 33 of them a hand-rolled <table class="data-table"> inside .table-scroll and 14 a Studio DataTable; 7 hold the loading skeletons that stand in for one; and 2 hold neither — AiChatPage's message column and AdminSystemLogsPage's log-file list. Every one is content that runs to the card's edge and needs the corner cut. flush is not the nearest available prop; it is what those 56 sites were.

The other 135 lose a clip that 20px of padding — now 24 — was already holding their content clear of. Studio's DropdownMenu and Popover portal, so the floating layers a clip would have caught are not there to catch. One padded card does hold absolutely-positioned descendants — PwaSplashPage's splash preview, an icon and a caption placed inside a 160×284 mock — and the clip was never reaching them: neither .card nor .lk-card nor anything between declares position, so their containing block is the page and they have been escaping every ancestor since they were written. That preview is broken today and is broken identically after this change; it is recorded as an open item rather than repaired inside a conversion, because the fix is a position: relative on the mock and has nothing to do with the card.

3. hover was three things, and seven of its nine uses were a lie

.card.is-interactive          { cursor: pointer; }
.card.is-interactive:hover    { border-color: var(--outline-strong);
                                box-shadow: var(--shadow-raised); }
.card.is-interactive:active   { transform: scale(0.992); }

One prop, three claims: this lifts when you point at it, this can be clicked, and this responds when you press it. Nine call sites passed it. Naming the immediate container of each — the ADR-0028 procedure, which is what found this — sorts them:

  • 1 is a control: CataloguePage's product card, a <div role="button" tabIndex={0}> with a hand-written Enter/Space handler.
  • 2 are decoration inside a control: AdminDashboardPage and DirectoryPage wrap theirs in a <Link> and an <a>.
  • 6 have no click target of any kind — the four AI history lists, ProjectsPage and QrCodesPage. No onClick, no role, no tabIndex, no wrapper. A pointer cursor and a press animation on a card that does nothing at all.

That is a shipped-but-dead affordance on six screens, which is non-negotiable #7's territory, and it had been invisible for the same reason everything else here was: hover is one word and the CSS behind it was three declarations.

Studio's .lk-card--hover:hover is the lift alone — border, shadow, and a 2px rise. It is right, and the app's was wrong, and the difference between them is a prop that is spelled the same in both.

The general shape. ADR-0033's finding was a prop census that counted the wrong thing (aria-label rather than the icon-only shape, missing 14 unnamed buttons). This one is smaller and worse: the census was complete and correct and still saw nothing, because the diff lived entirely outside the props. padding was a style attribute, overflow was a declaration, and hover was one name over three rules. A prop table is a description of what a call site can say. It is not a description of what a component does — and the fewer props a component has, the more of its behaviour is somewhere the table cannot reach.

Decision

Diff the rendered declarations, not only the props — and do it for every component, but do it first where the prop list is short. A two-prop component is not a small conversion; it is a conversion whose surface area has moved somewhere the checklist does not look. Concretely, before any conversion, put the two stylesheets' rules for the component side by side and enumerate the declarations each makes that the other does not. That is a five-minute mechanical step, it would have surfaced all three findings here, and no existing step in the Method performs it: ADR-0023 checks that every class the markup names exists in the layer, which is a different question from what those classes say.

For Card specifically:

  1. There is no padding axis. flush is the only lever, and it means my content runs to the edge and needs the corner cut — a statement about content, like EmptyState's compact is a statement about the container (ADR-0028), and not a size. The 6 sm/lg sites take the single gutter and the change is recorded rather than accommodated.
  2. hover is the lift and nothing else, and cursor moves onto the element. a.lk-card already existed; button.lk-card joins it, giving a card-button back the block layout, full width, left alignment, inherited font and pointer that a bare <button> takes away. A card that is a control says so with as, which is a thing the type system and the accessibility tree can both see, where hover was a thing only the stylesheet knew.
  3. CataloguePage stops hand-rolling a button. role="button" tabIndex={0} plus an Enter/Space handler is a <button> reimplemented with fewer behaviours; ADR-0019 makes the accessibility contract Studio's, and the element brings the role, the focusability and the key handling with it. It is the app's only card that was ever a control.
  4. Two raises the enumeration found, each a live defect for any Studio consumer before this app imported anything:
    • .lk-card--selected did not exist. DESIGN.md has specified it since the card base was written — "selected swaps border + fill to lime (--accent-line / --accent-soft)" — and the stylesheet never carried it. This is ADR-0023's gap read from the other side: not a rule the markup names and the layer lacks, but a rule the specification names and the layer lacks. The app's .card.is-selected was already exactly it, token for token through the alias bridge, so the raise costs nothing and its absence would have silently dropped ReferralsPage's highlight — .card.is-selected does not match a .lk-card.
    • .lk-card:focus-visible did not exist. A host's unscoped :focus-visible radius sits at (0,1,0) and lands after the component layer, so a focusable card focuses as a 6px rectangle around a 20px frame. Sixth instance of the trap .lk-btn, the input family and the password reveal already carry the fix for; --xl restates its own. Nothing could reach it before, because Studio had no way to make a card focusable — which is the same absence button.lk-card fills.

selected paints and does not announce, and that is a divergence from Chip worth stating. Chip takes the same prop and sets aria-pressed or aria-current from it, because a chip is always a button or an a and knows which. A Card is whatever as says, and there is no state attribute valid on every element it might be — aria-selected is legal only under a handful of roles. So the component draws the state and the call site carries whatever ARIA its own role requires. A component that cannot know its role cannot claim one.

Consequences

  • 191 call sites change appearance, and the deltas are the visible facts of the commit rather than a footnote: 131 padded cards go 20px → 24px, 6 of them from 16px or 32px; 4 more go to .alert's own 12px/16px, the rule finally reaching them; 56 flush cards are unchanged in geometry and keep their clip; 9 hovered cards gain a 2px rise; 7 lose a pointer cursor and 7 a press animation; 1 gains a real focus ring for the first time. One padded card — AiChatPage's 280px chat column, the only card in the app that declared its own overflow — states overflowX: 'hidden' where .card used to supply it, because an x-axis left visible beside a scrolling y-axis computes to auto and would have grown a second scrollbar.
  • .card and .card-pad stay in apps/web/src/styles/components.css. Grepping the class rather than the component (ADR-0021 step 1) finds eight hand-rolled .card emitters that never imported this component — BlockTypePicker, the three auth pages, two BiolinkEditorPage panels, a PlansPage <select> and an AiImagesPage <img> — and five for .card-pad. .card-grid (35 emitters) stays too; it is a grid utility the component never emitted and only shares a prefix with.
  • .card.is-interactive (three rules) and .card.is-selected are deleted — this component was the sole emitter of both. .card-header and .card-title go with them: their last emitter anywhere was the Card card on preview/current-design.html, retired on this same commit, which is the Badge conversion's pattern exactly. .card-footer, .card-pad-sm and .card-grid-lg were already dead before this conversion touched anything and are recorded as open items rather than swept up here.
  • Three live E2E specs located .card and now locate .lk-card (admin-plugins, admin-plan-settings, drawer-roundtrip). The first documents the coupling in a comment, which is how it was found; a conversion that greps only src/ misses all three.
  • CardProps lands in index.d.ts — the tenth Studio export this workstream has found coming out of index.js untyped, and the last one but Badge, whose note claimed to be the only one left and was wrong by two exports at the time it was written. Six deliberately wrong calls were rejected before a call site moved. ref is still not declared, following the house pattern and leaving ADR-0033's open item against the whole family where it is.
  • .lk-card__body / __title / __lead / __desc / __meta remain in 70-patterns.css, outside the standalone component layer, and this conversion deliberately does not move them. .lk-btn--danger was moved on the same argument one conversion ago, and the argument does not transfer: that was a variant the component emits, so a components-layer consumer got an unstyled button from calling the React API. These five are hand-written in the HTML demos and the React Card names none of them, so no consumer of @studio/react can reach the gap. It is real for a hand-authored consumer and it is recorded as an open item, not fixed inside a conversion that does not touch it.
  • What this does not decide. Swift's StudioCard pads with StudioSpace.s5 (20px) where --space-6 is 24px, clips unconditionally where CSS clips only under --flush, has no hover and no selected, and its docstring documents a size: .xl parameter the struct does not have. Four drifts, none of which the parity gate can see, because it matches names. Phase 04's problem, recorded here so it is not discovered there — the third such entry after StudioTone and StudioEmptyState.

Source: docs/decisions/0034-the-card-whose-every-difference-was-not-a-prop.md

Library