Repository navigation
fix(browser): restore viewport controls for client-hosted pages - #30353
oliver-mee wants to merge 12 commits into
Conversation
A remote-server page that renders on this desktop ("This device") showed
only the Draw button: Grab and Annotate were never wired up, although
main already registers the page's local guest, so the picker, selection
capture and annotation viewport bridge resolve to it unchanged.
The client-hosted pane now uses the shared BrowserChromeToolbar and
BrowserGuestAnnotateOverlays. The grab/annotation/markup wiring moves out
of the workspace preview into use-browser-guest-element-tools, shared by
both surfaces. Reloading the guest clears its annotations, matching local
tabs. Renderer-only; no IPC, RPC or wire change.
Fixes stablyai#20486
Refs stablyai#17384
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
An armed or confirming grab kept its window-level C/S listener and blocked Draw after the pane deactivated or the guest started a new load. Main settles only an awaiting pick on navigation, so a confirming one stayed armed. Cancel it on deactivation and on load start. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A comment card left open when the pane deactivated or the host replaced the guest survived, so Add could later attach element rects captured on a document that is no longer shown. Clear it alongside the markup capture on the same deactivation, replacement, failure and unmount triggers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ent-hosted pages Main now keeps browser notes across navigation and reload, retiring only their badges, and lets the comment card follow the picked element through guest viewport reports. Client-hosted pages adopt both: a document boundary (load start or main-frame navigation, including in-place) retires badges and drops a half-made pick instead of deleting saved notes, and the guest's console-message reports reach the shared overlay. The shared toolbar now folds tools into a required overflow menu on narrow panes; client-hosted pages get one with the folded tools and reload. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2c0de6f7-d74d-40b7-b358-e42637f14ed7
📒 Files selected for processing: 20
src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.guest-tools.test.tsxsrc/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsxsrc/renderer/src/components/browser-pane/annotate/use-browser-guest-element-tools.tssrc/renderer/src/components/browser-pane/annotate/use-client-hosted-browser-guest-tools.tssrc/renderer/src/components/browser-pane/annotate/use-client-hosted-browser-markup.tsxsrc/renderer/src/components/browser-pane/assemble-chrome/browser-toolbar-menu-dropdown.tsxsrc/renderer/src/components/browser-pane/assemble-chrome/browser-viewport-preset-menu.tsxsrc/renderer/src/components/browser-pane/assemble-chrome/client-hosted-browser-page-toolbar.tsxsrc/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.tssrc/renderer/src/components/browser-pane/browser-client-page-visible-attachment.tssrc/renderer/src/components/browser-pane/client-hosted-browser-load-failure.tsxsrc/renderer/src/components/browser-pane/client-hosted-browser-pane-test-rig.tssrc/renderer/src/components/browser-pane/host-guest/browser-page-viewport.tssrc/renderer/src/components/browser-pane/host-guest/use-browser-page-viewport-scroll-reporting.tssrc/renderer/src/components/browser-pane/use-client-hosted-browser-viewport.test.tsxsrc/renderer/src/components/browser-pane/use-client-hosted-browser-viewport.tssrc/renderer/src/components/browser-pane/workspace-doc/use-doc-preview-guest-tools.tstests/e2e/browser-viewport-control-parity.spec.tstests/e2e/helpers/client-hosted-browser-fixture.tstests/e2e/paired-client-hosted-browser-annotate.spec.ts
💤 Files with no reviewable changes: 1
- src/renderer/src/components/browser-pane/annotate/use-client-hosted-browser-markup.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
|
Thanks for this! #43777 brings viewport presets to This-device pages using your approach (preset-sized box, clipping the retained host, reapplying the override on load), on top of the files that have since moved. You're credited as a co-author. |
|
Thanks @oliver-mee! The This-device page toolbar now reuses the shared browser toolbar, which brings the ⋯ menu along with hard reload, zoom, favicon and download cancel. That landed in #43777, with a Co-authored-by line for you on the merge. Closing this one in favour of that. |
ELI5
Give a remote workspace's This device browser the same viewport presets and page-targeted DevTools action as a fully local page.
What Changed
Shares the viewport preset menu and sizing helpers, applies native guest metrics, reapplies them after DOM readiness, routes panning and scroll reporting to the client page, and clips retained guests without reparenting. Default resets both guest metrics and size. The DevTools action targets the actual desktop guest.
Why
A menu-only change would not change the rendered page. Sharing the preset behavior and testing actual guest width checks the workflow rather than just the button. External opening of host-only URLs stays disabled to avoid targeting the wrong machine.
Linked Issue
Fixes #30352
Visual Proof
Paired Electron interaction evidence from the combined integration checkout, not the standalone controls head. These show the same patched build before selecting a preset, after choosing Mobile M, and after resetting to Default. They are not screenshots of an unpatched build.
The test asserts actual guest innerWidth is 375 and grows after reset. A repeat run also passed annotation capture and real PTY submission using an adaptation of #19417. That delivery adaptation is not part of this PR. This remains stacked on #22813 and must not merge ahead of it.
Testing
October 25 refresh: merged current
mainat1d2b5361efa7851e95c4b24e5a9b298863f8fb7b, preserving the existing contribution history. Current headce6f5f50a844b488976ba84a56ca82c2262b4f5d: 41 focused tests across annotations, viewport presets, retained guests and shared toolbar behavior; renderer native typecheck and scoped lint/format pass. Kept upstream’s new-tab page, loading progress, link status and failure recovery. Added a regression proving Stop still stops the loading guest. Earlier application/Electron acceptance below belongs to its recorded earlier heads and was not repeated for this refresh. Substantive upstream CI remains a separate maintainer approval gate.Previously: 1,027 browser-pane tests across 128 files passed, plus renderer typecheck and scoped lint. Actual Linux Electron tests passed for both local and paired pages: choose Mobile M, verify guest innerWidth is 375, reset to Default and verify it grows. The paired test also picks an element and saves its annotation.
Refreshed against upstream
ba6599eab: 35 focused viewport, retained-guest and client-pane tests pass, as does renderer typecheck. App and CLI builds completed at22e9ec69f.The initial paired annotation run failed because the card did not appear after the fixture dispatched its synthetic click. Test-only commit
e0030b578now waits for the guest's actual selection listener (cancelAwait) before clicking and retains picker-state diagnostics on failure. With the same unchanged app build, that fixture passed once and then twice more in a serial repeat run, with retries disabled. This is three passes after a fixture change, not a clean initial run or proof of every intermittent startup condition. Mobile width, reset and saved annotation assertions all passed. The original failure trace is retained.Scoped lint passes for the changed spec. Full E2E typecheck was attempted and fails in other E2E/tool files, including terminal wheel and transcript fixtures; it reports no diagnostic for this changed spec. This is not a full typecheck pass. Windows and packaged-app testing remain unverified. Annotation Send submission is not implemented here; the separately adapted #19417 evidence above is not standalone acceptance of this PR.
Dependency
Stacked on #22813 by clodus-dev at a6d1729. Its annotation implementation is preserved, not replaced. The commits specific to this PR are 6f23792 and 93bc444, plus the current-main merge. Do not merge this as a competing annotation implementation; land #22813 first and then refresh this branch so the review diff contains only controls.
AI Disclosure
OpenAI GPT-6.1 Sol implemented and tested this change under human direction.
Review
Please review native viewport metrics, reset behavior and retained guest clipping. Annotation capture is inherited from #22813; independent delivery verification remains separate.
Agent skill upstream boundary
Notes
Upstream validation for
e0030b5785is waiting for maintainer approval: PR Checks. Focused local evidence above remains unchanged; no substantive current-head CI pass is claimed.This PR does not add profile selection, change cookie policy, or restore unsafe external URL routing.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with GPT-6.1 Sol
🧑💻 Ideated, directed and reviewed by a human, @oliver-mee