Repository navigation
feat(ui): browser panel scales the live frame instead of resizing the remote viewport - #148187
slzszyt-ux wants to merge 8 commits into
Conversation
…ewport The browser panel treated itself as the owner of the remote page's layout viewport: opening the panel, resizing the dock, or switching tabs re-requested the remote viewport at the panel's size. Dragging UI chrome therefore reflowed the page an agent is working on (media restarts, virtualized lists reset), and the panel's sidebar aspect forced pages away from their intended layout. The panel is a viewer. It now renders the live frame scaled to the panel (the CSS already preserves aspect), while the remote page keeps the viewport the agent or page chose. Pointer mapping (clicks, inspect hover) and stroke/highlight painting map against the rendered frame box so they stay exact at any scale. The legacy panel-driven resizing stays available via localStorage["openclaw.browserPanel.followViewport"] = "1".
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesAdds a saved browser-panel lock that preserves the remote viewport and scales the displayed frame with aligned input and annotations. Example: Resize the dock from 480×852 to 656×852 while viewing a 1920×937 page.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: the optional viewport lock remains meaningful distinct work, and the merged shared-window fix explicitly says it does not replace this PR. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherThe Control UI browser panel receives remote screenshots and viewport metrics, renders the page, and translates local pointer and annotation coordinates into remote page coordinates. flowchart LR
A[Dock and toolbar] --> B[Viewport controller]
B --> C[Browser request client]
C --> D[Remote browser]
D --> E[Frame and metrics]
E --> F[Scaled panel surface]
F --> G[Pointer and annotation mapping]
G --> C
Technical reviewBest possible solution: If sponsored, integrate the opt-in lock into the current toolbar and viewport owner while preserving browser-owner resize capability checks. Do we have a high-confidence way to reproduce the issue? Current main still resizes managed-browser viewports to panel dimensions; supplied live measurements demonstrate that behavior and the proposed opt-in alternative, without executing contributor code during this review. Is this the best way to solve the issue? The introduced patch places the preference with the existing viewport controller and shares frame geometry across input and annotation painting; current-main integration should use the replacement Solid owners rather than restore retired controllers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c55eea9b74a1. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +154, Tests +269. Total +423 across 14 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (12 earlier review cycles; latest 8 shown)
Reviewed November 22, 2026, 1:57 AM ET / 06:57 UTC (Revision 13). |
Review follow-ups for the browser-panel viewport change: - Keep the shipped follow-panel default; fixed-viewport viewing is now an opt-in toolbar toggle persisted in localStorage. - Paint annotations with a canvas translation at the painted frame origin instead of mixing pixel offsets into normalized coordinates. - Contain-fit the frame (object-fit) with a definite stage height so the whole page stays visible in short docks. - Map pointer input against the painted frame box and ignore letterbox margins so clicks and inspect stay aligned at any scale.
a39ac13 to
9603804
Compare
Move the fixed-viewport toggle state and setter into the viewport controller (which already owns viewport preferences), so the panel controller file stays under the 700-line lint limit.
The helpers are only used inside the viewport controller after the toggle moved there; knip flagged the now-unused exports.
E2E proof: with the toolbar lock enabled the panel stops resizing the remote page when its dock changes, and the frame keeps contain-fitting the dock. Captures follow/fixed screenshots under OPENCLAW_CAPTURE_UI_PROOF.
Runtime proof addedCaptured from the Control UI browser panel running this branch (repo e2e harness, real Chromium,
The behavior is asserted in Unit coverage: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
- Inspection tooltips use stage-relative coordinates again; the letterbox aware point stays reserved for remote requests. - Repaint the overlay when the dock geometry changes, including while the remote viewport is locked. - Reject clicks in the letterbox margin before capturing an inspected element, and invalidate a stale inspection when the pointer leaves the frame. - Give the toolbar icons a visible selected state (fixed-viewport lock, annotate, inspect).
- Entering the letterbox margin now invalidates the inspection owner, so a queued or in-flight reply cannot restore a cleared element/tooltip. - Native inspection stores stage coordinates for tooltip placement (frame coordinates stay reserved for remote/native input).
Native inspect replies do not consult the remote operation owner, so the margin guard must clear the highlight and advance the native inspection generation itself.
Real-page runtime evidenceServed the PR build ( Follow mode — shipped default (fresh profile)
Fixed-viewport mode — lock on (saved preference present in the profile)
The frame scales with the dock (contain-fit) while the remote page keeps its viewport, which is the visible difference between the two shots. Saved-profile behavior
Method: viewport numbers come from @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Scaled-input alignment proof + sanitized reload captureAligned input in a scaled frame (fixed-viewport mode). With the lock on, the dock is 656×852 while the remote page keeps its 1920×937 viewport, so the frame is contain-fit at 0.342× (656×320). Inspecting at the frame-relative position of the fixture's target (remote point 115,686 of 1920×937) resolved the remote element exactly — no offset: Reload evidence replaced with the neutral fixture capture (same link, updated file). The lock stays pressed after a Control UI reload and the panel reopens in fixed-viewport mode: Saved preference scope (for the decision). @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Author's stance on the saved-preference scope (the remaining decision): I'd like to keep the origin-wide opt-in scope as proposed — default off, remembered per Control UI origin, survives reloads — since it matches "saved viewing preference" semantics. If maintainers prefer a narrower scope (per chat session or per remote profile), say the word and I'll switch the storage key; it is a small change at the read/write sites with no migration. Compatibility notes are in the description: no existing key → off, and any value other than |
|
This pull request has been automatically marked as stale after 7 days without qualifying human activity. |
|
Closing due to inactivity. |








What Problem This Solves
The Control UI browser panel treated itself as the owner of the remote page's layout viewport: opening the panel, resizing the dock, or switching tabs sent
resizeBrowserViewport. Dragging UI chrome therefore reflowed the page an agent was working on (media restarts, virtualized lists reset), and the panel's sidebar aspect forced pages away from their intended layout.This adds an opt-in fixed-viewport mode (toolbar lock toggle, persisted per browser profile). With it enabled the remote page keeps the viewport its agent or document chose, and the panel scales the live frame to fit. The shipped follow-panel default is unchanged while the toggle is off.
Review follow-ups
.bp-shotnow usesobject-fit: containwith a definite stage height, so the whole page stays visible in short docks instead of overflowing.Evidence
node scripts/run-vitest.mjs run ui/src/components/browser-> 259 passed (19 files), including new coverage:pnpm ui:i18n:sync(English fallbacks recorded for pending keys; thecontrol-ui-locale-refreshworkflow translates after merge, which is the documented path when no provider is configured).Review follow-ups (revision 5)
queueInspectstores stage-relative coordinates for tooltip placement again, while the letterbox-aware point stays reserved for remote requests, so tooltips stay on the hovered element when the frame letterboxes.Review follow-ups (revision 6)
Review follow-ups (revision 7)
Runtime evidence
Served-PR-build proof on a real page with measured dock sizes and remote-viewport readings in both modes, plus saved-profile reload behavior: #148187 (comment)
Saved preference scope
openclaw.browserPanel.fixedViewportlives in the Control UI origin'slocalStorage: opt-in, default off, applies to every browser panel opened from that origin regardless of session or remote profile, and survives reloads. Per-session or per-remote-profile scoping is intentionally not implemented; that origin-wide scope is the point that needs maintainer acceptance.Additional evidence
Scaled-input alignment in a 0.342× frame (inspect resolves the remote element exactly) and the neutral reload capture: #148187 (comment)
Decision needed: saved preference scope
The lock is remembered in the Control UI origin's
localStorage(openclaw.browserPanel.fixedViewport), so after opting in it also applies to browser panels opened later in other sessions and remote profiles on the same origin.Compatibility: no migration. Existing profiles have no such key, so the lock stays off; any value other than
"1"is treated as off. Upgrading or rolling back cannot strand a user in a mode they did not enable.Maintainer acceptance of the chosen scope is the remaining gate.