Skip to content
Toolkit

ADR-0156 — The host ladder that bought no paint order

Status: Accepted · Date: 2026-08-31 · Track: 002 close-out (LEDGER drain, row 20 / open item 5) · Supersedes: nothing · Builds on: ADR-0018, ADR-0023, ADR-0154

Context

Studio's z ladder is five tokenized steps, and DESIGN.md says chrome layering is never ad-hoc: --z-base 0, --z-raised 10, --z-chrome 100, --z-overlay 1000 (scrim, modal, sheet, dropdown, palette), --z-toast 1100 (transient feedback, always on top).

The app added two stops in the gaps:

--z-menu: 500;   /* dropdowns, popovers - above chrome, below scrim */
--z-modal: 1050; /* above --z-overlay (1000), below --z-toast (1100) */

--z-menu puts a dropdown below every scrim, which is not a layer a dropdown can live on — so useAnchoredPosition, the app's copy of Studio's placement hook, wrote zIndex: var(--z-toast) inline on every panel it placed, out-specifying the class. Its comment said "above modal and drawer scrims, which the panel may be launched from". Studio's copy of the same hook writes --z-overlay.

That disagreement is open item 5, and it is the last blocker on item 129 — the app's 47-tag hand-rolled Select, which converts to SelectBox now that ADR-0154 has portalled its list. A converted call site would move from an inline 1100 to Studio's 1000, under the app's own --z-modal at 1050. The question the item asks is which of those two layers is right, and Studio frames it as an open question of its own (55-components-extended.css): a host with its own ladder "has to place --z-overlay above its modal or accept that it does not".

Both options are answers to a question the app does not have. Counting the emitters is what shows it:

  • --z-modal has three emitters. .nav-sheet and .admin-sidebar.is-drawer are drawn inside .nav-sheet-backdrop (AppLayout.tsx:170, AdminLayout.tsx:149), which is position: fixed; z-index: var(--z-overlay) — a positioned box with a non-auto z-index, so it establishes a stacking context and its descendants are ranked inside it and nowhere else. Their 1050 has never been compared against anything on the page. The third, .cmdk, is a genuine sibling of its own .overlay scrim and is written after it (CommandPalette.tsx:174-175), so it wins on DOM order at any equal value.
  • --z-menu has two live emitters, Select.tsx and Sidebar.tsx, and both portal to <body> and take the hook's inline z-index. Neither has ever painted at 500. (A third is a preview-page card, static and unscrimmed.)

So neither stop has ever decided a paint order. What they did was make the app look like a host with a ladder of its own, which is what forced the hook to climb over it.

Decision

The app's ladder is Studio's ladder. Both intermediate stops retire, and everything overlay-class goes to --z-overlay.

  • --z-menu and --z-modal are deleted from tokens.css.
  • .menu takes var(--z-overlay) — the layer DESIGN.md gives dropdowns and the layer .lk-menu--anchored already takes, so a .menu call site converting to a Studio panel does not move.
  • .nav-sheet, .admin-sidebar.is-drawer and .cmdk take var(--z-overlay). No paint moves: the first two are inside a stacking context that already flattened them there, and the third stays above its scrim on DOM order.
  • useAnchoredPosition writes var(--z-overlay), which is Studio's hook's value exactly.

Ties are broken by DOM order, and a portalled panel appends last. That is not a workaround — it is the same rule Studio already relies on for a menu opened inside a modal, working here for the same reason.

Consequences

Item 129 is unblocked. A converted Select keeps the layer it has, and the --z-overlay limit that Studio's SelectBox, Combobox and MultiSelect declarations each record is no longer a limit this host runs into. Those three doc comments cited "SESSION.md open item 5" as open; they cite this instead.

A toast can interrupt an open panel again. .lk-toasts is on --z-toast. While the hook wrote the same token, the two tied and the later portal won — so an open listbox painted over the toast interrupting it, which inverts what the top of the ladder is for. This is a behaviour change, and the only one in the diff.

Studio's open question stays open, with a third answer on the record. The comment in 55-components-extended.css offered a host two options; the one taken here is neither. A host that keeps to the five steps never reaches the question, and that is cheaper than ranking Studio's layer by hand.

The closure is ZLadder.test.tsx: the app spends the five Studio tokens and mints none, every overlay-class selector names --z-overlay, .nav-sheet-backdrop still declares both halves of the stacking context the decision rests on, and the hook's inline value is asserted from a rendered, opened Select. A page minting a sixth stop fails there rather than at whatever it paints over. Seven mutations, seven killed.

Source: docs/decisions/0156-the-host-ladder-that-bought-no-paint-order.md

Library