Repository navigation
feat(preview): add browser viewport and tab controls - #872
Merged
Merged
Conversation
nixuuu
enabled auto-merge (squash)
November 16, 2026 13:36
nixuuu
added a commit
that referenced
this pull request
Nov 16, 2026
## Change A tall Browser Preview could extend past the bottom of a wide sidebar because its intermediate container did not constrain the canvas height. Fit mode now measures the available surface and uses the smaller width/height scale, preserving the image proportions and keeping the entire viewport visible when the panel changes size. The surface reserves space for all four resize handles. Actual-size mode keeps the frame at 1:1 with scroll access to every edge. Updated the automation tools documentation and implementation status. Fixes: #872 ## Verification - `bun run --filter @canopy/web typecheck` — passed, no errors or warnings. - `bun run lint -- apps/web/src/lib/features/preview/AgentPreviewCanvas.svelte` — passed. - `bun run format -- apps/web/src/lib/features/preview/AgentPreviewCanvas.svelte` — completed. - `git diff --check` — passed. - Manually inspected the real preview component in a browser at desktop and phone panel widths, in light and dark themes, with portrait/landscape frames and a frame smaller than the panel. Confirmed preserved proportions, visible resize handles, and no scrolling in fit mode. - Checked live panel resizing, normalized pointer coordinates, keyboard resizing, and scroll access at 1:1. Panel resizing sends no remote viewport resize commands. - Copy audit: no UI text changes. The full repository verification gate remains with GitHub CI.
nixuuu
added a commit
that referenced
this pull request
Nov 16, 2026
## Change Returning to a thread restores its mini preview and minimization state. Each thread also remembers whether its side panel is open, whether Files or Preview is selected, and which preview tool is active. Panel metadata survives reloads in local workspace storage; preview targets remain in scoped session memory and frames are discarded when a watch closes. The mini preview uses one fixed icon button for minimize/restore, with accessible labels, tooltips and keyboard focus preserved. Viewport width, height and Apply remain visible in narrow panels: the toolbar wraps and these numeric fields omit the +/− buttons. Other numeric controls retain their existing steppers. Documented the implemented behavior and its persistence boundaries in the workspace and automation docs. ## Verification - Passed web typecheck with zero errors or warnings, lint on edited source files, formatting and diff whitespace checks. - Checked real components in a browser with a temporary fixture and simulated preview streams: separate A/B/C panel states, reload persistence, mini preview restore/minimization, stream cleanup and sidebar handoff. Confirmed no transient mini watch starts for the wrong thread. - Checked light/dark themes, desktop and a 390 px phone viewport. Viewport fields and Apply remain visible at panel widths 320, 390, 468, 520 and 1100 px. Verified resize submission, keyboard increments, empty-field validation and disabled controls. - Copy audit (§8): passed. Existing labels are retained as tooltips/accessibility names; short, typical and long titles were checked at desktop and phone widths. Icon-only restore replaces the inconsistent text button without losing its accessible action name. - Passed integration-tests package typecheck and all four device-view persistence tests through `check:tmp`, with no temporary files left behind. - Remaining repository checks, integration tests and builds run in CI. No web UI test suite or verification artifacts were added. Fixes: #846 Fixes: #872
nixuuu
added a commit
that referenced
this pull request
Nov 16, 2026
## Change Dragging a browser viewport handle previously resized the remote browser every 120 ms, making it difficult to match a visible rectangle. Dragging now shows a local outline and target dimensions while the live image keeps its size; releasing sends one resize. This works when shrinking or expanding from all four edges. Thin, muted handles sit outside the image. The outline lives outside the scroll surface so it cannot introduce scrollbars or change the image scale. Escape, window blur, pointer cancellation and lost capture discard the draft. Keyboard resizing remains available. Updated the automation tools documentation and implementation status. Fixes: #872 ## Verification - Web typecheck: 0 errors and 0 warnings. - Lint and formatting of both changed Svelte files; diff whitespace check passed. - Agent Browser with the real Preview component in an isolated local harness: exercised synthetic pointer gestures for shrinking and expanding each edge, verified no resize during the gesture, unchanged canvas geometry and exactly one resize on release. Verified all four cancellation paths. - Visually checked light and dark themes on desktop and at 390 px phone width; checked 320 px wrapping and actual-size scrolling without handle overlap on the toolbar. Screenshots reviewed by the user. - Full repository checks and builds remain with CI. No persistent UI test suite added, per repository policy. Copy audit (§8): passed for the new “Release to apply · Esc to cancel” hint. Previously there was no drag guidance; the hint explains when the size applies and how to cancel. Labels remain unchanged. Sentence case, plain language, glossary, accessibility, duplication and narrow-width checks passed; error, empty-state and humour checks are not applicable.
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.
Summary
Browser Preview now keeps the agent's viewport independent from the sidebar width. Users can set width and height explicitly, resize from any edge, and select another tab from the browser session.
The worker forwards the session tab list, switches tabs through
agent-browser tab <tabId>, and refreshes the active frame and metadata. The compact viewport controls share the interaction status row and support four-digit dimensions.Validation
bun run check:tmp ./apps/worker/src/agent-preview/browser.test.ts— 7 tests passedbun run --filter @canopy/web typecheck— passedbun run --filter @canopy/worker typecheck— passedbun run --filter @canopy/gateway typecheck— passedbunx oxlinton edited preview, shared UI, worker, and gateway files — passedbun run gen:check— passedgit diff --check— passedCopy audit
Browser tab,Choose a tab,Viewport,Viewport width,Viewport height, and edge resize labels use sentence case, direct actions, and explicit accessible names.Browser previews follow the active tabtoBrowser previews use the session tabsso the error matches tab selection in Preview.