feat(browser): improve integrated browser controls - #296
Conversation
Summary by CodeRabbit
WalkthroughThe integrated browser now supports two-axis scrolling and origin-scoped page zoom from 25% to 200%. Zoom state persists across matching pages and navigation, and resets when browser data or scope changes. The browser panel can maximize, restore, and control zoom. App-shell state coordinates browser and artifact panels. Preview capture remains protected against stale requests. Documentation and agent guidance describe responsive browser content and horizontal scrolling. Sequence Diagram(s)sequenceDiagram
participant User
participant BrowserPanel
participant BrowserService
participant BrowserManager
participant BrowserPage
User->>BrowserPanel: select zoom or maximize
BrowserPanel->>BrowserService: send zoom request
BrowserService->>BrowserManager: forward session and factor
BrowserManager->>BrowserPage: apply normalized factor
BrowserPage-->>BrowserPanel: return updated page state
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
resources/wanta-skills/browser/SKILL.md (1)
31-32: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMake one-axis scrolling explicit.
When only horizontal panning is required, tell the agent to pass
deltaY: 0.electron/browser/control-server.tsLine 113 still converts an omitteddeltaYto 600, sobrowser_scroll({ deltaX: 500 })also moves down. Add examples for horizontal-only and vertical-only scrolling.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@resources/wanta-skills/browser/SKILL.md` around lines 31 - 32, Update the scrolling guidance in SKILL.md to explicitly pass deltaY: 0 for horizontal-only panning, avoiding the control server’s default vertical movement. Add examples demonstrating both horizontal-only scrolling with deltaY: 0 and vertical-only scrolling with deltaX: 0.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@resources/wanta-skills/browser/SKILL.md`:
- Around line 31-32: Update the scrolling guidance in SKILL.md to explicitly
pass deltaY: 0 for horizontal-only panning, avoiding the control server’s
default vertical movement. Add examples demonstrating both horizontal-only
scrolling with deltaY: 0 and vertical-only scrolling with deltaX: 0.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 230bfc05-1f5f-4c29-9d63-7442a2261cf9
📒 Files selected for processing (18)
docs/ai/integrated-browser-implementation.mddocs/integrated-browser.mdelectron/agent/manager.tselectron/agent/tool-sources.tselectron/browser/common.tselectron/browser/control-server.test.tselectron/browser/control-server.tselectron/browser/node.tselectron/browser/page.test.tselectron/browser/page.tsresources/wanta-skills/browser/SKILL.mdsrc/components/app-shell/AppShell.tsxsrc/components/app-shell/AppShellRightPanel.tsxsrc/components/app-shell/use-artifacts-panel-state.tssrc/i18n/app-messages.en.tssrc/i18n/app-messages.zh.tssrc/routes/Chat/BrowserPanel.test.tssrc/routes/Chat/BrowserPanel.tsx
Summary
Improve the integrated browser's right-panel experience and make wide or fixed-layout content easier to inspect without adding a second browser surface.
Problem
The browser inherited several constraints from the artifacts panel: it could not use the full content area, had no explicit page zoom controls, and agent scrolling was vertical-only. Renderer modals also need a current visual fallback because Electron
WebContentsViewcontent composites above renderer overlays. Generated HTML artifacts could compound the problem by locking the root viewport or assuming a fixed canvas size.For users, this meant narrow browser pages were harder to inspect, wide content could not be panned by the agent, and modal transitions could show stale browser imagery. An earlier fit-to-width control was also visually ambiguous and had no visible effect on responsive sites.
Changes
deltaXsupport tobrowser_scroll, including bounded defaults, bridge parsing, Playwright dispatch, tests, and Browser Skill guidance.Validation
corepack pnpm run lintcorepack pnpm run formatcorepack pnpm run ts-checkcorepack pnpm test— 283 test files and 2,138 tests passedcorepack pnpm run build:appFocused coverage includes zoom normalization and origin scoping, horizontal scroll defaults and bounds, maximized browser controls, native-view modal visibility ordering, in-flight visibility transitions, non-blocking hidden-page preview capture, and stale preview suppression.