From 8612cfd40fcfd2d4dae6bff6b9b9ac940c7e7bbd Mon Sep 17 00:00:00 2001 From: Vance Ingalls Date: Sat, 22 Aug 2026 05:01:48 -0700 Subject: [PATCH] fix(studio): put the timeline's portaled surfaces on the tier the other portals use (#3414) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(studio): put the timeline's portaled surfaces on the tier the other portals use The FX popover, the grouping dialog it swaps for, and the automation selection menu are all portaled to `document.body`, so they land in the root stacking context — where they sat at `z-50` while the app's own chrome occupies 60, 90, 91, 92, 94, 100 and 110, and every other portal that has to clear that chrome (`Tooltip`, `AssetContextMenu`, `InlineTextToolbar`, `RenderQueue`) already uses `z-[200]`. These three were the odd ones out. Scoped honestly: the clipping in the report is fixed by the height cap in the previous commit, which is what actually cut the popover off at the timeline chrome. This commit is tier consistency — it removes the standing risk of a portaled timeline surface losing to any of those seven higher tiers, rather than a demonstrated repro. Confirm against a real window before claiming more. * fix(studio): move the remaining body-portaled context menus to the same tier The all-sites audit in review was right and the previous commit did half the set. Using `createPortal(…, document.body)` as the predicate rather than the timeline directory, four more surfaces sit in the root stacking context at `z-50` below the seven chrome tiers (60, 90, 91, 92, 94, 100, 110): - `player/components/ClipContextMenu.tsx:51` - `player/components/TrackGapContextMenu.tsx:78` - `player/components/KeyframeDiamondContextMenu.tsx:99` - `components/editor/CanvasContextMenu.tsx:215` The fourth is the easy one to miss — it is the only one outside `player/components/`, so a timeline-scoped sweep finds exactly the other three. It belongs to the same set by its own account: its className is byte-identical to `ClipContextMenu`'s and its header comment says it mirrors that file's look, positioning, and dismiss behaviour, portaled to `document.body`. Two body portals deliberately left alone. `sidebar/BlocksTab.tsx:125` portals `PromptPreviewModal`, which carries its own `z-[100]`/`z-[110]` modal tier — a `z-` class on the portal wrapper would be dead weight. `RenderQueue.tsx:235` is already `z-[200]`. `FileTree.tsx:336` and `FileTreeNodes.tsx:103` are `fixed z-50` but are NOT portaled — they render inside the sidebar's own stacking context, so the root-context argument does not reach them and raising them would be an unrelated change. Crossing the `z-[100]`/`z-[110]` modal backdrops is unreachable for the same reason it was for the first three: all four dismiss on an outside pointerdown, so the press that opens a modal closes the menu first. `CanvasContextMenu.test.tsx:95` asserted on `.fixed.z-50` to prove the menu did NOT render; left as-is it would have passed vacuously against any tier. Updated to the new class so it still fails if the menu renders. Co-Authored-By: Claude Opus 5 (1M context) * fix(studio): correct the interval in the popover in-bounds test comment `bottom: 32` with `maxHeight: 160` in a 200px viewport puts the box at y = 8..168, not y = 8..40 — the bottom edge sits at `innerHeight - bottom`, and the comment read it as the height instead. The assertions below already computed the right geometry; only the stated interval was wrong, on a regression test whose comment is the next reader's model of what it pins. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- .../studio/src/components/editor/CanvasContextMenu.test.tsx | 2 +- packages/studio/src/components/editor/CanvasContextMenu.tsx | 2 +- .../studio/src/components/editor/TimelineFxPopover.test.tsx | 2 +- packages/studio/src/components/editor/TimelineFxPopover.tsx | 2 +- .../studio/src/player/components/AutomationSelectionMenu.tsx | 2 +- packages/studio/src/player/components/ClipContextMenu.tsx | 2 +- .../studio/src/player/components/KeyframeDiamondContextMenu.tsx | 2 +- packages/studio/src/player/components/TimelineFxButton.tsx | 2 +- packages/studio/src/player/components/TrackGapContextMenu.tsx | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/studio/src/components/editor/CanvasContextMenu.test.tsx b/packages/studio/src/components/editor/CanvasContextMenu.test.tsx index 0fd9b6d21b..ccb00a088f 100644 --- a/packages/studio/src/components/editor/CanvasContextMenu.test.tsx +++ b/packages/studio/src/components/editor/CanvasContextMenu.test.tsx @@ -92,7 +92,7 @@ describe("CanvasContextMenu — handler gating", () => { // No menu opened at all — no buttons, no dead-end items, no DOM mutation. expect(menuButtons()).toHaveLength(0); - expect(document.body.querySelector(".fixed.z-50")).toBeNull(); + expect(document.body.querySelector(".fixed.z-\\[200\\]")).toBeNull(); expect(el.style.zIndex).toBe("3"); }); diff --git a/packages/studio/src/components/editor/CanvasContextMenu.tsx b/packages/studio/src/components/editor/CanvasContextMenu.tsx index 0fae550544..24601271c1 100644 --- a/packages/studio/src/components/editor/CanvasContextMenu.tsx +++ b/packages/studio/src/components/editor/CanvasContextMenu.tsx @@ -212,7 +212,7 @@ export const CanvasContextMenu = memo(function CanvasContextMenu({ return createPortal(
{ const dialog = withViewportHeight(200, () => dialogOf(mount({ anchorRect: rect(100, 120) }).host), ); - // bottom:32 + maxHeight:160 puts the box at y = 8..40 — a margin on each side. + // bottom:32 + maxHeight:160 puts the box at y = 8..168 — a margin on each side. expect(dialog.style.bottom).toBe("32px"); const bottom = Number.parseFloat(dialog.style.bottom); const height = Number.parseFloat(dialog.style.maxHeight); diff --git a/packages/studio/src/components/editor/TimelineFxPopover.tsx b/packages/studio/src/components/editor/TimelineFxPopover.tsx index 46c07bf05d..70f827bf6f 100644 --- a/packages/studio/src/components/editor/TimelineFxPopover.tsx +++ b/packages/studio/src/components/editor/TimelineFxPopover.tsx @@ -125,7 +125,7 @@ export function TimelineFxPopover({ ref={rootRef} role="dialog" aria-label="Effects" - className="z-50 flex flex-col overflow-hidden rounded-md border border-white/10 bg-[#1b1b1f] p-2 shadow-xl" + className="z-[200] flex flex-col overflow-hidden rounded-md border border-white/10 bg-[#1b1b1f] p-2 shadow-xl" style={clampedStyle(anchorRect)} onKeyDown={onKeyDown} onPointerDown={(event) => event.stopPropagation()} diff --git a/packages/studio/src/player/components/AutomationSelectionMenu.tsx b/packages/studio/src/player/components/AutomationSelectionMenu.tsx index f157f6e266..f64890a03b 100644 --- a/packages/studio/src/player/components/AutomationSelectionMenu.tsx +++ b/packages/studio/src/player/components/AutomationSelectionMenu.tsx @@ -41,7 +41,7 @@ export const AutomationSelectionMenu = memo(function AutomationSelectionMenu({ return createPortal(
{AUTOMATION_SHAPES.map((shape) => ( diff --git a/packages/studio/src/player/components/ClipContextMenu.tsx b/packages/studio/src/player/components/ClipContextMenu.tsx index 4a448aee7c..c7ccde2d12 100644 --- a/packages/studio/src/player/components/ClipContextMenu.tsx +++ b/packages/studio/src/player/components/ClipContextMenu.tsx @@ -48,7 +48,7 @@ export const ClipContextMenu = memo(function ClipContextMenu({ ref={menuRef} role="menu" aria-label="Clip actions" - className="fixed z-50 bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]" + className="fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]" style={{ left: adjustedX, top: adjustedY }} > {splitLabel && ( diff --git a/packages/studio/src/player/components/KeyframeDiamondContextMenu.tsx b/packages/studio/src/player/components/KeyframeDiamondContextMenu.tsx index 5e0c0365b7..886defff80 100644 --- a/packages/studio/src/player/components/KeyframeDiamondContextMenu.tsx +++ b/packages/studio/src/player/components/KeyframeDiamondContextMenu.tsx @@ -96,7 +96,7 @@ export function KeyframeDiamondContextMenu({ ref={menuRef} role="menu" aria-label="Keyframe actions" - className="fixed z-50 bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px] overflow-y-auto" + className="fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px] overflow-y-auto" style={{ left: adjustedX, top: adjustedY, maxHeight: `calc(100vh - ${adjustedY + 8}px)` }} > {onMoveToPlayhead && ( diff --git a/packages/studio/src/player/components/TimelineFxButton.tsx b/packages/studio/src/player/components/TimelineFxButton.tsx index 882ebe1abc..b874ecb18c 100644 --- a/packages/studio/src/player/components/TimelineFxButton.tsx +++ b/packages/studio/src/player/components/TimelineFxButton.tsx @@ -79,7 +79,7 @@ export function TimelineFxButton(props: TimelineFxButtonProps) {
event.stopPropagation()} > diff --git a/packages/studio/src/player/components/TrackGapContextMenu.tsx b/packages/studio/src/player/components/TrackGapContextMenu.tsx index 5808890817..8d2fd72ea2 100644 --- a/packages/studio/src/player/components/TrackGapContextMenu.tsx +++ b/packages/studio/src/player/components/TrackGapContextMenu.tsx @@ -75,7 +75,7 @@ export const TrackGapContextMenu = memo(function TrackGapContextMenu({ return createPortal(
onHoverAction(null)} >