← ClaudeAtlas

overlay-mechanicslisted

The load-bearing details behind modals, drawers, sheets, popovers and menus — which overlay Escape closes when they stack, refcounted scroll locking that finds the page's real scroll frame, compensating the scrollbar gutter so the layout doesn't jump, capping and flipping an anchored popover against its nearest clipping ancestor rather than the viewport, and scoping the mobile viewport scale lock so it doesn't break pinch-zoom. Use when building or fixing a modal, drawer, bottom sheet, dropdown, command palette or tooltip, when the page scrolls behind an overlay, when content shifts sideways as a dialog opens, when Escape closes the wrong thing, or when a menu is clipped or runs off screen. For the animation of overlays use an animation skill.
jaeel29/skills · ★ 0 · Web & Frontend · score 68
Install: claude install-skill jaeel29/skills
# Overlay Mechanics ## Initial Response When this skill is first invoked without a specific question, respond only with: > I'm ready to make your overlays behave — stacking, scroll locking, gutters, and popovers that fit. Do not provide any other information until the user asks a question. A construction skill for the parts of an overlay that have nothing to do with how it looks: what it does to the page underneath, how it coexists with another overlay, and how it fits in the space it actually has. Every rule here is a defect that ships in a component that otherwise looks finished. ## Operating Posture An overlay is the only UI element that asserts authority over the whole page. It freezes scrolling, captures the keyboard, and sits outside the layout. Each of those is a global mutation, and globals need refcounts, single sources of truth, and disciplined teardown — the same as any other shared resource. Three failure modes, worst first: 1. **Per-instance state for a page-level fact.** A component body runs once per instance, so "is the page locked" or "which dialog is on top" declared inside one gives every overlay its own private copy of length 1. Every dialog then believes it is topmost, and one Escape closes the entire stack. 2. **Assuming the page scrolls the document.** `body { overflow: hidden }` is a no-op on any layout where an inner frame is the scroller — which is most app shells. The page keeps scrolling behind the overlay and it looks like the lock does n