AddThisFeature

Elevation Layer Map

Decide once what covers what, so overlays stop appearing behind the page.

moderate Design Systems

What it adds

A documented ordering of the app's overlay layers — sticky chrome, menus, popovers, dialogs, notifications — and the rules for how they interact.

What your agent is told to do

5
  1. 1

    List every element in the app that can overlap something else: sticky headers, bottom navigation, drawers, dropdown menus, popovers, tooltips, dialogs, toasts, and the command palette. Order them by what must always win when two are on screen together.

  2. 2

    Write down the interaction rules alongside the order, not just the order itself: which layers may open while another is open, which dismiss the layer below, and which trap focus. An ordering without those rules only fixes the paint, not the behaviour.

  3. 3

    Handle nesting explicitly. A popover opened from inside a dialog must render above that dialog, and closing the dialog must close it, so nested overlays need to know the layer of their opener rather than assuming a global value.

  4. 4

    Decide how each layer interacts with persistent navigation. A drawer that slides under a fixed sidebar and a toast that lands beneath the mobile tab bar are both the same unspecified overlap, and both need an answer written down.

  5. 5

    The numeric values themselves belong to Z-Index Registry; this feature owns the ordering and the behaviour, that one owns the tokens and enforcement. Do not define a second set of numbers here.

Edge cases it handles

7
  • Any ancestor with a transform, filter, opacity below one, or a containment property creates a local stacking context, and a child inside it cannot escape upward no matter how high its value goes. Those ancestors have to be found and either removed or the overlay rendered outside them.
  • Nested overlays — a menu inside a popover inside a dialog — must stack in the order they were opened and unwind in reverse, or dismissing the outer one strands the inner one on screen with no way to close it.
  • Persistent navigation is the most common collision. Toasts landing under a mobile tab bar, drawers sliding beneath a fixed sidebar, and sticky action bars fighting a cookie banner all need a stated winner for the edge they share.
  • Overlays rendered into a portal at the end of the document leave the DOM order, so keyboard focus and screen reader order must be restored deliberately rather than left to the browser.
  • Fullscreen modes, whether the app's own focus layout or the browser's native fullscreen, change what the top layer even is. Anything that must remain reachable in fullscreen has to be rendered inside the fullscreen element.
  • Native top-layer elements such as dialogs and popovers ignore the ordering entirely and always paint above everything, which will surprise anyone assuming the map governs all layers.
  • Two toasts and a dialog opening in the same frame must not race — the ordering has to be deterministic regardless of which mounted first.

Definition of done

8
  • There is a single written ordering covering every overlapping surface in the app.
  • Each layer's rules state what it may open over, what it dismisses, and whether it traps focus.
  • A popover opened from within a dialog renders above it and closes with it.
  • No overlay is clipped or hidden by a local stacking context.
  • Every collision with persistent navigation has a documented winner.
  • Numeric values come from Z-Index Registry rather than being redefined here.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.