Repository navigation
Hide the native browser view behind any overlay that covers it - #3755
Closed
dillionverma wants to merge 1 commit into
Closed
dillionverma wants to merge 1 commit into
dillionverma wants to merge 1 commit into
Conversation
The embedded browser tab is an Electron WebContentsView, a native layer that always paints above the renderer DOM. Only shared-ui Dialogs registered as browser-dimming modals, so popovers, menus, the floating composer, plugin overlays and other floating windows rendered underneath the page. BrowserTabContent now hit-tests its content area with elementsFromPoint whenever the DOM changes and hides the native view when anything other than the browser surface is on top. Hides caused by an overlay capture a page snapshot first so the page stays visible under the overlay instead of blanking. The split-drag guard opts out via a passthrough attribute so pane resizing keeps the live view. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Contributor
|
Thanks @dillionverma for the PR. This repo needs approval before a PR. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ) and explain what you want to open a PR for and why. A maintainer then adds you to the allow list. This PR now closes on its own. Reopen it or open a new one after approval. |
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.
Human comments
What was wrong
The embedded browser tab is an Electron
WebContentsView, a native layer that always paints above the renderer DOM. The only thing that hid it was the shared-uiDialog, which registers itself throughuseBrowserDimmingModal. Popovers, dropdown menus, the floating new-thread composer, plugin app overlays, and any other floating window never registered, so they rendered underneath the page whenever a browser tab was open in the secondary panel.What changed
apps/app/src/components/secondary-panel/useBrowserViewOcclusion.ts(new): hit-tests the browser content area withdocument.elementsFromPointon a 48px grid whenever the DOM changes (childList mutations immediately, attribute mutations and scroll/resize throttled, plus transition and animation end). If the topmost element at any sample is not the browser surface, the native view is hidden. This covers every overlay, including plugin ones, without per-component registration. Elements markeddata-bb-browser-view-passthroughare looked through; the split-drag guard uses this so pane resizing keeps the live view.BrowserTabContentcombines this with the existing dimming-modal signal. When the view hides because something covers it, the hide request carriessnapshot: true.packages/desktop-contract/src/browser.ts: optionalsnapshotflag on the set-visible request. Renderer to main IPC only; no daemon wire change, soHOST_DAEMON_PROTOCOL_VERSIONis untouched.apps/desktop/src/desktop-browser-view.ts: a snapshot hide captures the page first (same cap and JPEG path as the resize snapshot), pushes it over the existing snapshot channel, then hides. Duplicate hide requests while a capture is in flight are ignored. Showing again clears the snapshot. A show that arrives before capture completes discards the snapshot.browserViewVisibilityCoordinator.hideaccepts{ snapshot }.Known limits: overlays with
pointer-events: noneare invisible to hit-testing, and overlays smaller than the grid spacing can slip through. Menus, dialogs, and floating windows are all well above that size.How you verified
useBrowserViewOcclusion.test.tsx(hit-test semantics, passthrough, mount/unmount tracking, disabled state),BrowserTabContent.occlusion.test.tsx(view hides withsnapshot: truewhen an overlay appears and shows again when it leaves), coordinator snapshot option, and threedesktop-browser-view-managercases (capture then hide, discard on early show, hide without snapshot on capture failure).pnpm exec turbo run typecheck lint --filter=@bb/app --filter=@bb/desktop --filter=@bb/desktop-contractclean.vitest run src/components/secondary-panelin@bb/app(394 tests) andtest/desktop-browser-view-manager.test.tsin@bb/desktoppass.turbo run dev --filter=@bb/desktop; it starts cleanly. Manual overlay check still pending.🤖 Generated with Claude Code