diff --git a/CLAUDE.md b/CLAUDE.md
index cae6573..451a77b 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -675,6 +675,17 @@ easy to break:
placed relative to the panel, not the window — the sidebar's playlist menu
opened far from the cursor. `.glass`'s blur and tint therefore live on its
`::after` (z-index -1 under `isolation: isolate`), not on the panel.
+- **Every overlay renders through `createPortal(…, document.body)`** — all
+ dialogs, `ContextMenu` and `Toast`. Each `.glass` panel is a stacking context
+ (`isolation`), so an overlay rendered INSIDE one can never rise above a
+ neighbouring panel, whatever its z-index: New Export (from the sidebar) sat
+ behind the library, and the deck's Auto Hotcues dialog behind both. One
+ z scale, set on the overlay's root: dialogs `z-50`, a dialog opened from a
+ dialog (`FolderPicker`) `z-[60]`, menus `z-[70]`, toasts `z-[80]`. A new
+ overlay that skips the portal will look fine when opened from `App` and break
+ the first time a panel opens it. Small popovers anchored to a control inside a
+ scrolling list should open the shared `ContextMenu` instead (as the playlist
+ row's "Add to export" does) — a popover inside the list is clipped by it.
- **The accent is `oklch(0.8 0.11 var(--accent-hue))`** — the cover's hue at a
FIXED lightness and chroma, so dark text on it keeps its contrast whatever is
loaded. `lib/ambient.ts` sets `--accent-hue` and `--amb-1..4` on ``;
diff --git a/frontend/src/components/AnalyzeGridDialog.tsx b/frontend/src/components/AnalyzeGridDialog.tsx
index 8687132..03c4ff4 100644
--- a/frontend/src/components/AnalyzeGridDialog.tsx
+++ b/frontend/src/components/AnalyzeGridDialog.tsx
@@ -1,3 +1,4 @@
+import { createPortal } from 'react-dom'
import { useEffect } from 'react'
interface Props {
@@ -23,10 +24,10 @@ export function AnalyzeGridDialog({ total, existing, locked, onChoose, onClose }
return () => window.removeEventListener('keydown', onKey)
}, [onClose])
- return (
+ return createPortal(
-
+ ,
+ document.body,
)
}
diff --git a/frontend/src/components/ContextMenu.tsx b/frontend/src/components/ContextMenu.tsx
index 3ac7cff..36bc284 100644
--- a/frontend/src/components/ContextMenu.tsx
+++ b/frontend/src/components/ContextMenu.tsx
@@ -1,3 +1,4 @@
+import { createPortal } from 'react-dom'
import type { ReactNode } from 'react'
import { useEffect, useRef, useState } from 'react'
import { Icon } from '../lib/icons'
@@ -55,7 +56,7 @@ export function ContextMenu({ x, y, items, onClose }: Props) {
}
}, [])
- return (
+ return createPortal(
// `contents`: the panels are fixed-positioned, so this wrapper must take no
// part in layout. As an ordinary empty block it became one more item in
// the app's gapped flex column and pushed every panel down by a gap.
@@ -69,7 +70,8 @@ export function ContextMenu({ x, y, items, onClose }: Props) {
return { top, left: Math.min(x, window.innerWidth - 180), maxHeight: window.innerHeight - top - 8 }
})()}
/>
-
+ ,
+ document.body,
)
}
@@ -101,7 +103,7 @@ function MenuPanel({
return (
<>
{items.map((item, i) => {
diff --git a/frontend/src/components/EditTagsDialog.tsx b/frontend/src/components/EditTagsDialog.tsx
index 74e7dce..76f80bf 100644
--- a/frontend/src/components/EditTagsDialog.tsx
+++ b/frontend/src/components/EditTagsDialog.tsx
@@ -1,3 +1,4 @@
+import { createPortal } from 'react-dom'
import { useRef, useState } from 'react'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { api, type Track } from '../api'
@@ -95,9 +96,9 @@ export function EditTagsDialog({ track, onClose, onApplied, onError }: Props) {
apply.mutate()
}
- return (
+ return createPortal(