Skip to content
Toolkit

ADR-0025: A conversion is not done until the component is visible where it lands — the clip belongs to the call site, and the call site is in scope

Context

Eight conversions had produced a working checklist, and every item on it asks a question about the component or its stylesheet:

  • ADR-0019 — does the authored component implement the app's behaviour and Studio's contract?
  • ADR-0020 — does its CSS ship in a layer the consumer can import alone?
  • ADR-0021 — does deleting the app CSS strand a hand-rolled consumer?
  • ADR-0022 — does the component pad its own edges rather than asking the call site to know what its container is doing?
  • ADR-0023 — does the layer the consumer imports define every class the markup names?

Tooltip is the first conversion to answer all five cleanly. Every class Studio's Tooltip emits — .lk-tip, .lk-tip__bubble, its --wrap modifier and the kbd descendant rule — was already in dist/studio.components.css, the layer apps/web/src/index.css imports. The one behavioural question the session file had flagged, Studio's

@media (max-width: 719px) { .lk-tip__bubble { display: none; } }

also resolved harmlessly: the shell hides .sidebar outright below 767.98px and Sidebar returns null when AppLayout reports mobile, so the rule never reaches this consumer.

By the checklist, this was the import swap that eight conversions had been looking for.

It was not. The component was invisible at its only call site, and had been since it was written.

What the checklist does not look at

Tooltip's one call site wraps each nav item when the sidebar is collapsed to a rail, so the icon has a name. That call site lives inside .sidebar-nav, which scrolls:

.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; ... }

Only overflow-y is declared. CSS does not allow one axis to remain visible while the other scrolls, so overflow-x computes to auto as well, and the nav becomes a clipping scroll container — 56px wide, in a 76px rail.

Measured in Chromium against the repository's real stylesheets (.station/jobs/002-renaissance/evidence/tooltip-rail-clipping.mjs):

x-rangevisible
.sidebar-nav visible box10 → 66—
the app's bubble, position="right", as shipped66 → 1300%
Studio's bubble, default top placement−9 → 8460%, both ends cut

Zero. Not a sliver — the pill began exactly at the clip edge. The only thing naming a collapsed nav icon had never painted a pixel, and nothing in the repository could see it: not tsc, not ESLint, not the parity gate, not the Studio lint, not the namespace check, not the visual suite (which renders the public biolink page, which has no sidebar), and not the live E2E navigation spec, which forces the sidebar expanded before asserting and so never executes the tooltip branch at all.

Two things follow, and they pull in opposite directions.

It is not a regression the conversion introduces. The app component was equally invisible. A conversion that swapped one invisible bubble for another would have changed nothing a user could see, passed every gate, and moved the parity counter — which is exactly what makes it tempting.

It is also the third dead surface a conversion has exposed, after ConfirmDialog's unclickable dialog and Skeleton's zero-height loading state (ADR-0021). Those two were fixed inside their conversions, and ADR-0021 says why that was not adjacent cleanup: the rule the surface depended on was being deleted, so leaving it was knowingly shipping a broken surface.

The workstream standard is not ambiguous about which way that resolves (docs/guides/workstream.md): "Nothing user-visible was left wired to nothing. If a control ships, it works. Three shipped-but-dead subsystems are on record; there will not be a fourth."

Why placement is not the fix

The obvious step was to give Studio's Tooltip the placement the app component had — its positionStyles map offers top, bottom, left, right, and the call site passes right. Studio's bubble is hard-anchored above.

Placement is necessary and it is not sufficient. The clip is 56px wide and full height, and a bubble wide enough to hold a word overflows it in every direction: right is removed entirely, top and bottom lose both ends and overlap the neighbouring item, left runs into the sidebar's own edge. Placement chooses a direction; it cannot buy room that a scrolling ancestor has already taken away. Shipping the prop alone would have shipped four values none of which its only consumer could see.

Nor can the clip be dropped. overflow-y: auto is load-bearing, and the comment above it records the bug it fixed — the nav running past the sidebar and its last item sitting under the workspace card. The navigation registry declares ~33 sidebar destinations across four sections, which is ~1456px of rail nav; the viewport would have to be ~1598px tall for it to fit. It overflows at 800px, at 1080px and at 1440px alike.

Decision

A conversion is not done when the call sites compile. It is done when the component is visible where it lands — and when it is not, the clip is part of the conversion, not a follow-up.

Three rules.

  1. Before converting a component that draws outside its own box — a tooltip, a menu, a popover, anything absolutely positioned — walk up from the call site to the first ancestor whose computed overflow is not visible, and measure the component against that box rather than against its trigger. overflow-y: auto alone is enough to create one: a single-axis declaration clips both axes. The class-level checks (ADR-0020/0023) ask what the component says about itself; this one asks what its ancestors do to it, and nothing else in the checklist covers it.

  2. The component carries direction; the consumer carries room. Studio's Tooltip gains placement and four .lk-tip__bubble--* modifiers, because pointing a tooltip at a side of its trigger is the component's business and every target should have it. Making space for it inside a 56px scroll container is the consumer's, because only the consumer knows why it scrolls. This is ADR-0022's split — the component pads its own edges — read from the other end: the component cannot pad its way out of somebody else's clip, and it should not try. Cardsite's rail widens its padding box by 260px and pulls the same distance back with a negative margin, which moves the clip edge without moving anything inside it; the overhang is made transparent to the pointer so it cannot eat the main column's clicks, and the rows opt back in. Moving that edge moves the scrollbar with it — a scroll container draws one at the inline end of its padding box — so the rail hides its own rather than painting a 6px thumb 252px away from the icons it belongs to. Whoever takes this trick next should expect that pairing: the room and the scrollbar are one decision.

  3. A tooltip describes; it does not name. Studio wires aria-describedby through useId, which is a real improvement on the app version's nothing — but a description is not an accessible name, and .nav-item-label is display: none in the rail, so the link had no name at all. The conversion puts aria-label on the link. This matters beyond the collapsed case: the shell rails itself below 1280px whether or not the collapse flag is set, and the tooltip renders only on the flag, so between 768px and 1280px every nav link is an unnamed icon with no tooltip available at any width. A name on the trigger holds in every band; a tooltip does not.

Consequences

  • The rail's tooltips are visible for the first time. So is the general capability: placement is in packages/core/src, so the static target and any future consumer get it, not just React.
  • One measurement ships as an executable rather than a paragraph. evidence/tooltip-rail-clipping.mjs builds a page from the repository's real stylesheets, reproduces the rail, and exits non-zero while the bubble is invisible. --no-clip lifts the nav's overflow and the same run turns green, which is what distinguishes a clip from a mistake in the harness.
  • The fix is scoped to the container that has the problem (.sidebar.is-rail .sidebar-nav), not to Studio's Tooltip. That leaves a real question open, and it is recorded rather than answered: Studio's own useAnchoredPosition exists because "a panel rendered where it is declared is clipped by the first scrolling or transformed ancestor above it", and DropdownMenu, Popover, ConfirmDialogHost and ResourceUrl all portal to <body> for that reason. A tooltip that portalled would need no room from any consumer. It would also stop being CSS a static consumer can use, which is a trade this ADR does not make on one call site's evidence. When a second consumer hits the same clip, that is the decision to take, and .lk-tip__bubble already declares var(--z-overlay) — the layer useAnchoredPosition returns — so the layer question is not what blocks it.
  • The checklist grows a fourth item, and it is the first that cannot be answered by reading the component or its stylesheet. A grep will not find it; it has to be measured in a browser.

Source: docs/decisions/0025-a-conversion-is-not-done-until-the-component-is-visible-where-it-lands.md

Library