You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Design Mode comment popover renders behind the <webview> — invisible at native width, partially cut off with Device Toolbar #7260
The Design Mode comment popover (element-picker → comment box → send) fails to appear after capturing an element. At native browser-pane width it doesn't show at all; with the Device Toolbar (responsive simulation) on, only a disconnected fragment (the send button) is visible, floating away from the selected element.
Note: diagnosed by reading source + a user's screenshots, not reproduced hands-on by me — treat as a hypothesis, not a confirmed root cause.
Repro steps
Open a page in the in-app browser pane.
Click Design, select an element (highlight + banner appear correctly).
Observe: no comment popover (native width), or only the send button floating apart from the element (Device Toolbar on, e.g. iPhone SE 375×667).
Expected: popover appears anchored under the selected element.
Actual: invisible or fragmented/mispositioned.
Root-cause hypothesis
The guest page renders via a legacy tag (browserRuntimeRegistry.ts:302), which is documented to composite above sibling host-DOM elements regardless of CSS z-index on some Electron/GPU combinations. The codebase already works around related quirks (browserRuntimeRegistry.ts:82, pointer-event swallowing).
DesignModePopover (DesignModePopover.tsx) is a plain positioned host-DOM
, not injected into the guest page — so it's the layer a can occlude. The element-capture banner/highlight, by contrast, are injected inside the guest page itself, hence always visible.
Separately, BrowserPane.tsx:157-193's position math (placeholder.offsetLeft/offsetTop + rect) doesn't account for scroll on the overflow-auto wrapper added when the Device Toolbar is active (BrowserPane.tsx:289-294), which can compound the mispositioning when the simulated device overflows the pane.
Ask: please confirm whether stacking is the actual cause, and consider rendering the popover via the same in-page-overlay mechanism used for the selection banner, or explicitly lowering/hiding the webview while the popover is open.
Steps to reproduce
Open a page in the in-app browser pane.
Click Design, select an element (highlight + banner appear correctly).
Observe: no comment popover (native width), or only the send button floating apart from the element (Device Toolbar on, e.g. iPhone SE 375×667).
Expected: popover appears anchored under the selected element.
Actual: invisible or fragmented/mispositioned.
The report is that after picking an element in Design Mode the comment composer never becomes usable: nothing visible at native pane width, and with the Device Toolbar on only a fragment (the round send button) appears, detached from the selected element. The banner and the in‑guest highlight are fine, which the reporter reads as "host‑DOM layer occluded by <webview>". I read the current code on main (also 1.26.0, apps/desktop/package.json:5) and I don't think stacking is the whole story — the composer already portals into a layer built specifically to sit above the webview — but I found four separate, reader‑verifiable defects in that flow, two of which explain "detached fragment" and one of which explains "no popover at all" without any compositing involved.
What I ruled out (and how to confirm it in 5 seconds)
The composer is not a sibling of the webview competing on z-index. It's portalled into the registry's overlay layer:
BrowserPane.tsx:316-374 portals the find bar, the design composer, the error overlay and the blank‑page state into overlayContainer.
That container is created in browserRuntimeRegistry.ts:337-345 as a position: fixed, z-index: 1 sibling appended after the <webview> inside #browser-runtime-root, and it mirrors the webview's rect (browserRuntimeRegistry.ts:241-250).
So the find bar (BrowserFindBar.tsx:74 — pointer-events-auto absolute right-3 top-3 z-30 bg-popover) is structurally identical to the composer root (DesignModePopover.tsx:178 — pointer-events-auto absolute z-20) and lives in the same layer. Control experiment for the compositing hypothesis: press ⌘F on the same page. If the find bar paints over the page, the layer works and the composer's problem is geometry/lifecycle, not stacking. If the find bar is also invisible, it really is a guest‑surface compositing problem and the fix belongs in the registry (promote the overlay to its own composited layer, or hide/lower the webview while an overlay is open).
Also worth a decisive check on the phase: the banner text differs per phase (BrowserPane.tsx:244-254). "Element captured — describe the change…" means phase === "confirming" and the composer is mounted (paint/position bug). Still reading "Design mode — click any element…" means the composer was never rendered — see #4 below.
Suspected root causes
1. The anchor uses a hard-coded card height that is ~2.4× the real one.BrowserPane.tsx:181 assumes estimatedHeight = 170, but the card is one text row plus one control row (DesignModePopover.tsx:202-263) — roughly 70–90 px. Consequences, both matching the screenshots:
the flip-above branch (BrowserPane.tsx:186-190) fires whenever the element's bottom is within 170 px of the page area's bottom — very likely inside a 375×667 emulated viewport;
when it flips, top = rect.y - 170 - 4 leaves a ~90 px gap between the card and the element it describes, i.e. a card "floating away from the selected element".
2. Nothing re-lays-out the webview/overlay on scroll.updateLayout (browserRuntimeRegistry.ts:241-250) runs only from a ResizeObserver on the placeholder (browserRuntimeRegistry.ts:567-571) and a window resize (browserRuntimeRegistry.ts:162-166). With the Device Toolbar the placeholder sits in an overflow-auto wrapper (BrowserPane.tsx:291-297), so scrolling that wrapper moves the placeholder's getBoundingClientRect() without any resize event — the fixed‑position webview and overlay both stay at the stale rect. The composer's math then mixes a fresh placeholder.clientWidth/clientHeight (BrowserPane.tsx:178-179) with an overlay that is no longer where the placeholder is. The reporter's scroll observation is real, though the file/line has moved to BrowserPane.tsx:291-297.
3. Page zoom is not applied to the anchor.rectViewport is captured in guest CSS pixels (design-mode-script.ts:470) and consumed 1:1 as host pixels (BrowserPane.tsx:173-197). Chromium zoom is per-origin and persists across navigations (browserRuntimeRegistry.ts:300-312), so at any zoom ≠ 100% the card is offset proportionally to zoomFactor — which the registry already tracks in state and could be multiplied in.
4. The composer is gated behind a best-effort screenshot that can take up to 15 s.designModeStore.ts:152-168 awaits browser.designModeScreenshotbefore setting phase: "confirming"; that call goes through capturePageImage, which retries until CAPTURE_DEADLINE_MS = 15_000 (browser-manager.ts:72, browser-manager.ts:701-739). If capture is slow or failing (parked/throttled pane, GPU hiccup), the user sees exactly the reported "nothing happens": the guest froze the highlight on click (design-mode-script.ts:578-584) while the host is still in selecting. The screenshot is explicitly documented as non-fatal, so it shouldn't block the UI.
Minor, but a silent-failure path: the composer render is gated on workspaceId from useParams({ strict: false }) (BrowserPane.tsx:325-327). It's always defined today (the pane registry only mounts under the $workspaceId route), but if it were ever undefined the banner would still show and the composer silently wouldn't — worth a log or invariant.
Reproduction
Deterministic, no guessing needed:
Bump react-dom from 18.3.1 to 19.2.0 #1: Device Toolbar → iPhone SE, pick an element in the lower half of the page. Expect the card jammed ~90 px above the element instead of adjacent to it.
Bump lucide-react from 0.468.0 to 0.546.0 #2: Device Toolbar with a device taller than the pane, scroll the grey wrapper, then pick an element. Page and overlay stay at the old rect.
Bump tailwind-merge from 2.6.0 to 3.3.1 #4: Watch the banner string right after the click. If it stays on "Design mode — click any element…" for seconds, you're in the screenshot wait, not a paint bug.
For a bun:test regression, the anchor math needs to come out of the component first: extract computeDesignPopoverPosition({ areaWidth, areaHeight, rect, cardWidth, cardHeight }) next to BrowserPane.tsx and assert that an element near the bottom yields top === rect.y - cardHeight - 4 (card bottom touching the element's top) and that the flip only happens when the card genuinely doesn't fit — the current code can't be tested at all because the height is a literal inside the effect.
Suggested fix direction
Measure instead of estimating: put a ref on the composer root, ResizeObserver it, and recompute top from its real height (initial render can be visibility: hidden for one frame, or clamp on first measure). Drop the 170.
Re-run updateLayout on scroll: window.addEventListener("scroll", …, { capture: true }) alongside the existing resize listener in installGlobalListeners (browserRuntimeRegistry.ts:162-166), so any ancestor scroll re-syncs the webview and overlay rects.
Scale rectViewport by the pane's zoomFactor when converting to overlay coordinates.
Set phase: "confirming" as soon as the selection payload arrives and merge the screenshot into the payload when it resolves (designModeStore.ts:152-168), so the composer is never blocked on capture.
Only if the ⌘F control experiment shows the find bar is invisible too: fix it once in the registry for the whole overlay layer (composited-layer promotion, or pointer-events/visibility handling on the webview while an overlay is open) rather than reimplementing the composer inside the guest page — an in-guest composer would also mean injecting agent-picker UI and prompt text into an untrusted page, which is worth avoiding.
Activity
github-actions commentedon Sep 7, 2026
Summary
The report is that after picking an element in Design Mode the comment composer never becomes usable: nothing visible at native pane width, and with the Device Toolbar on only a fragment (the round send button) appears, detached from the selected element. The banner and the in‑guest highlight are fine, which the reporter reads as "host‑DOM layer occluded by
<webview>". I read the current code onmain(also1.26.0,apps/desktop/package.json:5) and I don't think stacking is the whole story — the composer already portals into a layer built specifically to sit above the webview — but I found four separate, reader‑verifiable defects in that flow, two of which explain "detached fragment" and one of which explains "no popover at all" without any compositing involved.What I ruled out (and how to confirm it in 5 seconds)
The composer is not a sibling of the webview competing on z-index. It's portalled into the registry's overlay layer:
BrowserPane.tsx:316-374portals the find bar, the design composer, the error overlay and the blank‑page state intooverlayContainer.browserRuntimeRegistry.ts:337-345as aposition: fixed,z-index: 1sibling appended after the<webview>inside#browser-runtime-root, and it mirrors the webview's rect (browserRuntimeRegistry.ts:241-250).So the find bar (
BrowserFindBar.tsx:74—pointer-events-auto absolute right-3 top-3 z-30 bg-popover) is structurally identical to the composer root (DesignModePopover.tsx:178—pointer-events-auto absolute z-20) and lives in the same layer. Control experiment for the compositing hypothesis: press ⌘F on the same page. If the find bar paints over the page, the layer works and the composer's problem is geometry/lifecycle, not stacking. If the find bar is also invisible, it really is a guest‑surface compositing problem and the fix belongs in the registry (promote the overlay to its own composited layer, or hide/lower the webview while an overlay is open).Also worth a decisive check on the phase: the banner text differs per phase (
BrowserPane.tsx:244-254). "Element captured — describe the change…" meansphase === "confirming"and the composer is mounted (paint/position bug). Still reading "Design mode — click any element…" means the composer was never rendered — see #4 below.Suspected root causes
1. The anchor uses a hard-coded card height that is ~2.4× the real one.
BrowserPane.tsx:181assumesestimatedHeight = 170, but the card is one text row plus one control row (DesignModePopover.tsx:202-263) — roughly 70–90 px. Consequences, both matching the screenshots:BrowserPane.tsx:186-190) fires whenever the element's bottom is within 170 px of the page area's bottom — very likely inside a 375×667 emulated viewport;top = rect.y - 170 - 4leaves a ~90 px gap between the card and the element it describes, i.e. a card "floating away from the selected element".2. Nothing re-lays-out the webview/overlay on scroll.
updateLayout(browserRuntimeRegistry.ts:241-250) runs only from aResizeObserveron the placeholder (browserRuntimeRegistry.ts:567-571) and awindowresize (browserRuntimeRegistry.ts:162-166). With the Device Toolbar the placeholder sits in anoverflow-autowrapper (BrowserPane.tsx:291-297), so scrolling that wrapper moves the placeholder'sgetBoundingClientRect()without any resize event — the fixed‑position webview and overlay both stay at the stale rect. The composer's math then mixes a freshplaceholder.clientWidth/clientHeight(BrowserPane.tsx:178-179) with an overlay that is no longer where the placeholder is. The reporter's scroll observation is real, though the file/line has moved toBrowserPane.tsx:291-297.3. Page zoom is not applied to the anchor.
rectViewportis captured in guest CSS pixels (design-mode-script.ts:470) and consumed 1:1 as host pixels (BrowserPane.tsx:173-197). Chromium zoom is per-origin and persists across navigations (browserRuntimeRegistry.ts:300-312), so at any zoom ≠ 100% the card is offset proportionally tozoomFactor— which the registry already tracks in state and could be multiplied in.4. The composer is gated behind a best-effort screenshot that can take up to 15 s.
designModeStore.ts:152-168awaitsbrowser.designModeScreenshotbefore settingphase: "confirming"; that call goes throughcapturePageImage, which retries untilCAPTURE_DEADLINE_MS = 15_000(browser-manager.ts:72,browser-manager.ts:701-739). If capture is slow or failing (parked/throttled pane, GPU hiccup), the user sees exactly the reported "nothing happens": the guest froze the highlight on click (design-mode-script.ts:578-584) while the host is still inselecting. The screenshot is explicitly documented as non-fatal, so it shouldn't block the UI.Minor, but a silent-failure path: the composer render is gated on
workspaceIdfromuseParams({ strict: false })(BrowserPane.tsx:325-327). It's always defined today (the pane registry only mounts under the$workspaceIdroute), but if it were ever undefined the banner would still show and the composer silently wouldn't — worth a log or invariant.Reproduction
Deterministic, no guessing needed:
For a
bun:testregression, the anchor math needs to come out of the component first: extractcomputeDesignPopoverPosition({ areaWidth, areaHeight, rect, cardWidth, cardHeight })next toBrowserPane.tsxand assert that an element near the bottom yieldstop === rect.y - cardHeight - 4(card bottom touching the element's top) and that the flip only happens when the card genuinely doesn't fit — the current code can't be tested at all because the height is a literal inside the effect.Suggested fix direction
ResizeObserverit, and recomputetopfrom its real height (initial render can bevisibility: hiddenfor one frame, or clamp on first measure). Drop the170.updateLayouton scroll:window.addEventListener("scroll", …, { capture: true })alongside the existing resize listener ininstallGlobalListeners(browserRuntimeRegistry.ts:162-166), so any ancestor scroll re-syncs the webview and overlay rects.rectViewportby the pane'szoomFactorwhen converting to overlay coordinates.phase: "confirming"as soon as the selection payload arrives and merge the screenshot into the payload when it resolves (designModeStore.ts:152-168), so the composer is never blocked on capture.pointer-events/visibility handling on the webview while an overlay is open) rather than reimplementing the composer inside the guest page — an in-guest composer would also mean injecting agent-picker UI and prompt text into an untrusted page, which is worth avoiding.Kitenite commentedon Sep 7, 2026
fixed in #7232, shipped in 1.27.0 just now. could you update and check? ty for the report
nakajima-cz commentedon Sep 8, 2026
Thank you for your prompt response! I have confirmed that the issue has been resolved.
Kitenite commentedon Sep 8, 2026
Awesome thank you!