Drilling into detail stacks panels you can see and step back through, and one registry decides which panel an entity gets.

The problem

Click an order, then its customer, then the product they bought. The usual detail drawer either replaces itself each time, so you lose your way back, or it opens drawers on top of drawers with no sense of depth, where one Escape or one stray click closes everything.

There’s a second problem behind it. Each screen decides on its own which panel to show for a thing, and the panel can’t start loading until the drawer is open. So every click is a skeleton, even though the list row already knew what kind of thing it was.

What I concluded

A stack you can read

Each panel behind the front one steps back a fixed gap and shrinks slightly, so depth is visible at a glance, and clicking a panel peeking out behind jumps back to it. The page underneath goes inert while the stack is open.

  page (inert)  ┌─┬─┬──────────────┐
                │ │ │ Fiddle-leaf  │  ← front, interactive
                │ │ │ fig          │
                └─┴─┴──────────────┘
                 ↑ ↑ click to jump back

Escape pops exactly one layer and marks the event handled, so an outer listener doesn’t close the rest.

const onKey = (e) => {
  if (e.key !== "Escape" || e.defaultPrevented) return;
  e.preventDefault(); // one layer per Escape
  setDepth((d) => d - 1);
};

The subtle bug is the scrim. A click fires on the common ancestor of press and release, so selecting text in a panel and letting go over the dim closes the whole stack. The scrim only closes when the press started on it too.

One registry picks the panel

A single resolver maps an entity’s type, or failing that its most specific tag, to a panel entry: the component, how to prefetch its data, and optionally a link to its full page. It only needs { type, tags }, which the row has before anything is fetched. So the row warms the panel’s query on hover and on focus, and by the time the panel opens the data is usually there.

Keep the type and tag metadata in a module that imports no components. Rows import the metadata, the resolver imports the components, and the import cycle that this shape always grows never forms.

Rules

  • Depth is visible. A fixed step back per layer, and a peeking panel is a way back.
  • One Escape, one layer. Never the whole stack.
  • The scrim needs the press to start on it. Text selection can’t close anything.
  • Prefetch on intent. Hover and focus warm the query. Never mount a suspending query per row, or one slow preview blanks the list.
  • The registry owns the mapping. A new entity type is a new entry, not new shell code.

What you get

People can wander three levels deep and find their way back one step at a time. And panels open warm, because the decision about which one to show was made before the click.

The demo shows the stacking, jump-back and Escape order, plus the scrim guard. It doesn’t make the panels behind the front one inert or move focus back on close, which a production version should. Related: Modals, Data access.