Skip to content

fix(preview): compact toolbar overflow menu hidden behind preview iframe#8

Merged
fmw666 merged 1 commit into
mainfrom
fix/compact-toolbar-overflow-menu-stacking
Jun 5, 2026
Merged

fix(preview): compact toolbar overflow menu hidden behind preview iframe#8
fmw666 merged 1 commit into
mainfrom
fix/compact-toolbar-overflow-menu-stacking

Conversation

@fmw666

@fmw666 fmw666 commented Jun 5, 2026

Copy link
Copy Markdown
Owner

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 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.

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 with position: fixed (recomputed on resize/scroll).

Single file: packages/preview-site/src/shell/toolbar/CompactToolbar.tsx.

Verification

  • tsc + eslint --max-warnings 0 clean; full verify:fast (707 tests) green via pre-push hook.
  • Driven live at 375px width: after tap the menu mounts under <body> and is the topmost element at its own center point (elementFromPoint hits a menu button, not the iframe).

🤖 Generated with Claude Code

…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>
@fmw666 fmw666 merged commit dbd4c3d into main Jun 5, 2026
4 checks passed
@fmw666 fmw666 deleted the fix/compact-toolbar-overflow-menu-stacking branch June 5, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant