fix(screenshot): hide overlays during capture so shots only contain page content - #64
Open
BB-fat wants to merge 1 commit into
Open
fix(screenshot): hide overlays during capture so shots only contain page content#64BB-fat wants to merge 1 commit into
BB-fat wants to merge 1 commit into
Conversation
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
bsk screenshot(and element screenshots viaPage.captureScreenshot) capture the extension's in-page overlays — the Agent-control mask, help/record/borrow panels — because they are DOM injected by the content script (shadow host withdata-bsk-overlay). Agents end up with screenshots polluted by BSK's own chrome instead of pure page content.Fix
Suppress overlays around every capture, with a painted-frame guarantee:
overlay.css: new:host([data-bsk-capture-hidden]) { display: none !important; }rule — hiding the host removes the whole shadow tree from compositing.content/capture-suppress.ts): onbeginit sets the attribute (refcounted for concurrent captures), then waits tworequestAnimationFrames before ack'ing, so the compositor has produced a frame without the overlay before any capture runs.enddecrements and restores at zero. Host remounts mid-suppression keep the hidden attribute. A 500ms rAF fallback prevents deadlock on hidden tabs (rAF never fires there; the attribute is applied synchronously, so any composited frame is still overlay-free).lib/capture-suppress-bridge.ts):withOverlaysHiddenForCapture(tabId, fn)— begin (await ack) → capture →finallyend. If the tab has no content script (chrome:// etc.), begin fails and the capture proceeds directly (no overlay can exist there anyway).tools/observation.ts: both capture paths wrapped — element clip via CDP and full-pagecaptureVisibleTab.No protocol/CLI changes; behaviour fix only.
Tests
handleScreenshotintegration asserting capture happens while hidden.pnpm lint,tsc --noEmit,wxt build: clean.React.acttsx failures are identical to the base commit (pre-existing env issue).