fix(preview): compact toolbar overflow menu hidden behind preview iframe#8
Merged
Merged
Conversation
…ing context The mobile toolbar's ⋯ (More tools) popover appeared dead on tap: the menu opened but was painted entirely behind the preview iframe. Root cause is stacking, not state. The compact toolbar uses `backdrop-filter` (glass effect), which makes it its own stacking context. The overflow menu was an absolutely-positioned descendant, so its `z-index: 40` only ordered it *within* the toolbar. The sibling <main> (preview iframe) comes later in the DOM at the same root z-level and therefore painted on top of the trapped menu. Fix: portal the menu + backdrop to <body> so they escape the toolbar's stacking context, and anchor the menu to the trigger's viewport rect with `position: fixed` (recomputed on resize/scroll). Verified at 375px width: menu now mounts under <body> and is the topmost element at its own center point (elementFromPoint hits a menu button, not the iframe). tsc + eslint clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the playground in compact / mobile layout (viewport
< 768px), tapping the toolbar's More tools (⋯) button appeared to do nothing.Root cause — stacking, not state
The menu did open; it was painted entirely behind the preview iframe.
The compact toolbar uses
backdrop-filter(the glass effect), which makes the toolbar its own stacking context. The overflow popover was an absolutely-positioned descendant, so itsz-index: 40only ordered it within the toolbar. The sibling<main>(preview iframe) comes later in the DOM at the same root z-level and therefore painted on top of the trapped menu.This was not introduced by the recent refactor (#7) — it dates back to the glass-toolbar change (
65f1622); the refactor only moved the code.Fix
Portal the menu + backdrop to
<body>so they escape the toolbar's stacking context, and anchor the menu to the trigger button's viewport rect withposition: fixed(recomputed on resize/scroll).Single file:
packages/preview-site/src/shell/toolbar/CompactToolbar.tsx.Verification
tsc+eslint --max-warnings 0clean; fullverify:fast(707 tests) green via pre-push hook.<body>and is the topmost element at its own center point (elementFromPointhits a menu button, not the iframe).🤖 Generated with Claude Code