Skip to content

Commit 8612cfd

Browse files
vanceingallsclaude
andauthored
fix(studio): put the timeline's portaled surfaces on the tier the other portals use (#3414)
* 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) <[email protected]> * 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) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
1 parent 277fe0f commit 8612cfd

9 files changed

Lines changed: 9 additions & 9 deletions

‎packages/studio/src/components/editor/CanvasContextMenu.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe("CanvasContextMenu — handler gating", () => {
9292

9393
// No menu opened at all — no buttons, no dead-end items, no DOM mutation.
9494
expect(menuButtons()).toHaveLength(0);
95-
expect(document.body.querySelector(".fixed.z-50")).toBeNull();
95+
expect(document.body.querySelector(".fixed.z-\\[200\\]")).toBeNull();
9696
expect(el.style.zIndex).toBe("3");
9797
});
9898

‎packages/studio/src/components/editor/CanvasContextMenu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export const CanvasContextMenu = memo(function CanvasContextMenu({
212212
return createPortal(
213213
<div
214214
ref={menuRef}
215-
className="fixed z-50 bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]"
215+
className="fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]"
216216
style={{ left: adjustedX, top: adjustedY }}
217217
onPointerDown={stopBubble}
218218
onMouseDown={stopBubble}

‎packages/studio/src/components/editor/TimelineFxPopover.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe("TimelineFxPopover", () => {
160160
const dialog = withViewportHeight(200, () =>
161161
dialogOf(mount({ anchorRect: rect(100, 120) }).host),
162162
);
163-
// bottom:32 + maxHeight:160 puts the box at y = 8..40 — a margin on each side.
163+
// bottom:32 + maxHeight:160 puts the box at y = 8..168 — a margin on each side.
164164
expect(dialog.style.bottom).toBe("32px");
165165
const bottom = Number.parseFloat(dialog.style.bottom);
166166
const height = Number.parseFloat(dialog.style.maxHeight);

‎packages/studio/src/components/editor/TimelineFxPopover.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function TimelineFxPopover({
125125
ref={rootRef}
126126
role="dialog"
127127
aria-label="Effects"
128-
className="z-50 flex flex-col overflow-hidden rounded-md border border-white/10 bg-[#1b1b1f] p-2 shadow-xl"
128+
className="z-[200] flex flex-col overflow-hidden rounded-md border border-white/10 bg-[#1b1b1f] p-2 shadow-xl"
129129
style={clampedStyle(anchorRect)}
130130
onKeyDown={onKeyDown}
131131
onPointerDown={(event) => event.stopPropagation()}

‎packages/studio/src/player/components/AutomationSelectionMenu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const AutomationSelectionMenu = memo(function AutomationSelectionMenu({
4141
return createPortal(
4242
<div
4343
ref={menuRef}
44-
className="hf-automation-menu fixed z-50 min-w-[140px] rounded border border-panel-border-input bg-panel-bg-2 py-1 shadow-lg"
44+
className="hf-automation-menu fixed z-[200] min-w-[140px] rounded border border-panel-border-input bg-panel-bg-2 py-1 shadow-lg"
4545
style={{ left: adjustedX, top: adjustedY }}
4646
>
4747
{AUTOMATION_SHAPES.map((shape) => (

‎packages/studio/src/player/components/ClipContextMenu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const ClipContextMenu = memo(function ClipContextMenu({
4848
ref={menuRef}
4949
role="menu"
5050
aria-label="Clip actions"
51-
className="fixed z-50 bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]"
51+
className="fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]"
5252
style={{ left: adjustedX, top: adjustedY }}
5353
>
5454
{splitLabel && (

‎packages/studio/src/player/components/KeyframeDiamondContextMenu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function KeyframeDiamondContextMenu({
9696
ref={menuRef}
9797
role="menu"
9898
aria-label="Keyframe actions"
99-
className="fixed z-50 bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px] overflow-y-auto"
99+
className="fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px] overflow-y-auto"
100100
style={{ left: adjustedX, top: adjustedY, maxHeight: `calc(100vh - ${adjustedY + 8}px)` }}
101101
>
102102
{onMoveToPlayhead && (

‎packages/studio/src/player/components/TimelineFxButton.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function TimelineFxButton(props: TimelineFxButtonProps) {
7979
<div
8080
role="dialog"
8181
aria-label="Group these clips to add effects"
82-
className="z-50 w-56 rounded-md border border-white/10 bg-[#1b1b1f] p-2.5 text-[11px] text-white/75 shadow-xl"
82+
className="z-[200] w-56 rounded-md border border-white/10 bg-[#1b1b1f] p-2.5 text-[11px] text-white/75 shadow-xl"
8383
style={{ position: "fixed", left: anchorRect.left, top: anchorRect.bottom + 4 }}
8484
onPointerDown={(event) => event.stopPropagation()}
8585
>

‎packages/studio/src/player/components/TrackGapContextMenu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const TrackGapContextMenu = memo(function TrackGapContextMenu({
7575
return createPortal(
7676
<div
7777
ref={menuRef}
78-
className="fixed z-50 bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]"
78+
className="fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]"
7979
style={{ left: adjustedX, top: adjustedY }}
8080
onPointerLeave={() => onHoverAction(null)}
8181
>

0 commit comments

Comments
 (0)