ADR-0154 — One list, two forms: the modifier carries the portal
Status: Accepted · Date: 2026-08-31 · Track: 002 close-out (LEDGER drain, row 21 / item 18) · Supersedes: nothing · Builds on: ADR-0023, ADR-0025, ADR-0037
Context
SelectBox drew its listbox where it declared it: a <ul> inside
.lk-selectbox, position: absolute, toggled by the hidden attribute. Every
other anchored panel in overlays.jsx — the menu, the popover, the combobox,
both pickers — portals to <body> and takes its placement from
useAnchoredPosition, because an absolutely positioned child is clipped by the
first scrolling or transformed ancestor above it and no amount of anchoring
escapes that. Cardsite has two bites of this on record (ADR-0025): a type list
that showed half its options, and a drawer trapped in the content box by a page
transform.
SelectBox was the exception, and the exception was not a decision — it was
the one panel nothing had converted into a clipping container yet.
Combobox was authored partly around it: its own docstring, its type
declaration and its test suite each named "unlike SelectBox, the list is
portalled" as the reason the newer control exists in usable form. That is a
component existing to route around a defect in its sibling. Open item 18 has
carried it since the phase-01 authoring, and item 129 — the app's 47-tag
hand-rolled Select, which converts to this component — names it as one of two
blockers.
The complication is that .lk-selectbox__list has two renderings. The
vanilla layer (packages/core/src/studio.js) drives the static pages: it
leaves the list inside .lk-selectbox and toggles hidden, supplies no
placement of its own, and has no test suite anywhere. Switching the class to
position: fixed for React's benefit would place every static page's list
against the viewport with nothing writing the edges.
Decision
The anchored form is a modifier the React component emits; the class without
it stays the in-flow form. SelectBox renders
{mounted && open && createPortal(
<ul className="lk-selectbox__list lk-selectbox__list--anchored" style={panelStyle}>…</ul>,
document.body,
)}
and .lk-selectbox__list--anchored joins the group in
55-components-extended.css that already carries .lk-menu--anchored,
.lk-popover, .lk-datetime__panel and .lk-color__panel. This is
.lk-menu's shape exactly, one component over: the shell's own dropdown keeps
the bare class and the React path takes the --anchored modifier.
Three consequences follow from the modifier rather than being chosen:
inset: autois load-bearing. The base rule writestop/left/right, which still apply to a fixed box; the group'sinset: autois what hands the edges back to the measured rect.55-components-extended.cssloads after50-components.css, so the modifier wins at equal specificity without a!importantor an extra class.box-sizingmust be restated. It is declared once, at.studio-base *, and a panel under<body>is outside that. WithmatchWidthwritingwidth: <the trigger's rect>, the list's ownpadding: var(--space-1)would sit outside that width and it would overhang the button it is anchored to by 8px..lk-menu--anchoredrecords the same bite for the same reason; this is the second instance, and it is now a thing to check for any panel joining that group.aria-controlsbecomes conditional. The<ul>used to stay in the document underhidden, which is what let the button name it unconditionally. A portal that unmounts on close turns that constant attribute into a dangling IDREF, so it is written only while the list exists —Combobox's trade, made here for the same reason.
The offset is 4, not the hook's default 6: it is var(--space-1), the gap
top: calc(100% + var(--space-1)) writes for the in-flow form. The two
renderings of this list are meant to be indistinguishable, and a 2px
disagreement between a React route and a static page is exactly what ADR-0018's
one-design-system claim is about.
Consequences
SelectBox gains its first test suite (22 assertions), and it asserts both
forms: the base rule keeps position: absolute for the layer that never
portals, and the modifier is placed against the viewport. Asserting one alone
would let the other break silently, since the static pages have no suite at
all.
The component is also typed for the first time — SelectBoxProps and a
ForwardRefExoticComponent bound to the root <div>, which is the node the
component already forwards to and the only one in the composition a caller has
business holding. Types before call sites move (ADR-0026's rule): the suite
imports SelectBox from @studio/react, and an export index.d.ts does not
declare cannot be imported under tsc -b.
The remaining blocker on item 129 is item 5, the z-ladder: this panel sits at
--z-overlay like its four siblings, so a host whose modal ranks above that
paints over it. Portalling does not answer that and was never going to — it is
a decision about what the ladder means, not about where a box is rendered.
What this does not change: the keyboard model stays on the button per APG, the
options stay plain <li>s with no tabIndex, and the outside-pointerdown
handler already asked both boxes, so it needed no edit to survive the list
leaving the root.
One thing the suite pins rather than fixes. selectedIndex is
Math.max(0, options.findIndex(…)), so a value no option carries resolves to
index 0: the button reads the first option's label while aria-selected is
false on every row — the trigger and the list disagreeing outright about what
is chosen — and placeholder is unreachable for any non-empty options.
Combobox shows empty for that input. Fixing it is a decision about a shipped
control's behaviour and belongs in its own slice; LEDGER row 132 carries it,
and the test asserts what ships today so that changing it is a decision rather
than a regression.
Source: docs/decisions/0154-one-list-two-forms-the-modifier-carries-the-portal.md