useOverlay
Focus, scroll and Escape for anything over the page: dialogs, sheets, lightboxes. Overlays form one app-wide stack, so only the top one traps Tab and hears Escape, page scroll is locked once for the stack, and closing a nested overlay hands focus back into the one beneath. AppModal and AppImageModal use it.
Install: pnpm add-composable useOverlay
Nested panels
Open the outer panel, then the inner one. Escape closes only the top panel; focus returns to the button that opened it; scroll stays locked until both are closed.
API
panel(Ref<HTMLElement | ComponentPublicInstance | null>): The overlay panel. A component ref works (its $el is used), and it may only exist while open.open(MaybeRefOrGetter<boolean>): Whether the overlay is showing.initialFocus('first' | 'panel' | () => HTMLElement | null): Option. Where focus goes on open: the first focusable element, the panel itself (give it tabindex="-1"), or an element you pick.returnFocus(boolean): Option. Give focus back to the element that had it before opening.lockScroll(boolean): Option. Lock page scroll while open. tokens.css reserves the scrollbar gutter, so the page does not shift.onEscape(() => void): Option. Called on Escape while this overlay is on top, unless something inside (an open select) already handled it.focus(() => void): Returned. Moves focus into the panel again.focusableIn((root: HTMLElement) => HTMLElement[]): Separate export. The tabbable elements inside root, skipping hidden and inert ones.