fix(desktop): paint browser-pane overlays above the hoisted webview

Merged
KI
3mo ago
+198-87

Problem

Design mode in the browser pane looked broken: click the Design toggle, pick an element, and the banner flips to "Element captured" but no composer appears. The composer was rendered. It was painted underneath the page.

The webview is hoisted into a body-level container so it survives pane remounts. #6891 made the pane tree an isolated stacking context so resize handles stop painting above dialogs. Once the pane is its own stacking context, no z-index inside it can reach above a body-level sibling, so the composer (absolute z-20) and its click-catcher lost to the webview layer. Design mode shipped six days before #6891 and worked only because nothing between the pane and body created a stacking context.

The find bar and the load-error overlay were hidden the same way.

Fix

Each pane now gets an overlay layer in browserRuntimeRegistry: a sibling element appended directly after its webview, mirroring its rect (same updateLayout) and visibility (attach / detach / park / destroy). usePersistentWebview exposes it and BrowserPane portals everything that must cover the page into it:

  • design-mode composer + click-catcher
  • find bar
  • load-error overlay
  • blank-page "Start browsing" state

Layering is now relative to the webview instead of relying on the pane tree's stacking. isolate on the pane tree stays. The composer's position math simplifies since the layer's box is the placeholder's box.

Verification (CDP against the dev app)

Before: after picking an element, elementFromPoint at the composer's center returned WEBVIEW. Removing isolate from the pane tree live made it return the composer, confirming the cause.

After, under the same journey (Design toggle, hover, click in the page, all via real input on the host renderer):

Overlayhit-test at centerinteraction
Composerinside composertyped text lands in the textarea
Click-catchercatcher buttonclick re-arms picking
Error overlay (http://127.0.0.1:1/)inside overlayShow Details / Restart Browser present
Blank state (new pane)inside overlay
Find bar (Find in page)inside find barinput focused, "Card" → 1/4

No console.error during any step. Registry tests cover the overlay mirroring the rect and hiding on detach.

https://claude.ai/code/session_013znM5EPkdfUU9q5ttZ6F7F


Summary by cubic

Fixes design-mode overlays painting beneath the hoisted webview, which made the composer, find bar, and error/blank states invisible behind the page.

  • The webview lives in a body-level container and the pane tree is an isolated stacking context, so no z-index inside a pane can reach above the webview.
  • browserRuntimeRegistry now appends a fixed overlay layer for each pane directly after its webview, mirroring its rect and visibility.
  • BrowserPane portals the design-mode composer, click-catcher, find bar, error overlay, and blank state into that layer.
  • Overlays are click-through by default and each opt back into pointer events themselves.
  • Verified against the dev app via CDP: every overlay hit-tests to itself and accepts real input.

Summary by CodeRabbit

  • Bug Fixes
    • Improved browser pane overlays so find-in-page, design-mode controls, error messages, and blank-page states appear correctly above embedded web content.
    • Restored interaction with overlay controls, including clicking and typing.
    • Improved design-mode popover positioning and Escape-key behavior.
    • Kept overlay layers aligned and hidden appropriately as browser panes are moved or detached.