Skip to content

Simplify browser sizing to pane sync and fixed presets - #833

Merged
nedtwigg merged 13 commits into
mainfrom
simplify/browser-viewport-controls
Sep 29, 2026
Merged

nedtwigg merged 13 commits into
mainfrom
simplify/browser-viewport-controls

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

The Display dialog now offers two screencast sizing modes: Resize with pane and Fixed size. Fixed size contains a preset selector (including Custom) and editable width, height, and DPR. Selecting a preset fills the fields; editing them switches to Custom without silently pinning an omitted DPR.

Remove the Emulate dropdown and its GUI-only device lists. Device emulation remains available through the CLI.

Follow-up to #830, which has merged. Validation: full pnpm test passed; checked Phone preset selection and custom dimension editing in Storybook through dor agent-browser.

Also in this PR:

  • One provider choice for launch and display. A "switch to " link replaces the provider radios, shared by the Display modal and the terminal context's port row.
  • Port actions stay on one row. Trailing actions move into a "more…" dropdown as the context narrows. The icons are the Display modal's glyphs at the panel's icon size, and the iframe action uses the Display name "iframe embed".
  • Lowercase context actions. The Title, Dir, and Ports rows write their action text in lowercase, matching iframe and agent-browser. Tooltips and accessible names keep sentence case.
  • Title and Dir rows stay on one line too. Dir: the path's copy is an unlabeled icon, "open in Finder" drops to its icon, then the path truncates from its start. Title: "explain" drops to its icon, the title truncates to 8 characters, surface:N drops to its copy icon, then the title truncates further.
  • The webview device op is removed. The Emulate dropdown was its only caller. Device emulation stays in the CLI.
  • The "more…" dropdown only launches on a choice from its open list. Arrow keys open it, instead of changing the closed select's value on Windows and Linux Chromium.

Validation for these: lib pnpm test (4141 passed), the spec and public-docs lints, and the TerminalContext and AgentBrowserScreenModal Storybook play checks in Chromium. Checked the port row in Storybook through dor agent-browser.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: ec30d3d
Status: ✅  Deploy successful!
Preview URL: https://d625b2ec.mouseterm.pages.dev
Branch Preview URL: https://simplify-browser-viewport-co.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the Emulate dropdown gone, nothing sends the host's device op anymore. The modal was its only caller: ScreenActions.applyDevice (and its impl in agent-browser-surface-controller.ts) → BrowserHandle.device → { op: 'device' } in lib/src/lib/platform/browser-automation.ts → the case 'device' branches in browser-host.ts, agent-browser-host.ts and playwright-host.ts. dor agent-browser set device / dor playwright call the provider directly and don't go through this op. So "Device emulation remains available through the CLI" is true, but the webview path is left in place, along with its tests and the spec rules that describe it: the device row in the Browser Host op table, "serializes all viewport and device writes", "A Fixed viewport or device ends the browser's sync", and the Playwright "A device adds only its touch and user agent over the host's CDP session". A later reader will take all of this for a live path. Either remove the chain and those spec lines in this PR, or mark them Reserved: if you plan to bring a GUI entry point back. DimInput's disabled prop is now dead too; it only existed for device mode.

Comment thread docs/specs/dor-browser.md Outdated
nedtwigg and others added 7 commits September 28, 2026 17:02
…xt actions

The port row now uses BrowserDisplayIcon at the panel's 15px icon size and
the Display vocabulary ("iframe embed"), with a divider after the port and a
link-styled "more…" trigger over the native overflow select. The Title, Dir,
and Ports rows write their action text in lowercase to match `iframe` and
`agent-browser`; tooltips and accessible names keep sentence case.

Simplified along the way: one ActionFace for the copy and opening overlays,
one ACTION_BOX_CLASS shared with the overflow measurements, the provider
switch and chosen-provider state shared with the Display modal through
BrowserProviderSwitch, labels taken from BROWSER_DISPLAY_LABEL, and the
dead `fit` prop removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "more…" dropdown in the port row runs its action from the <select>'s onChange (PortLaunchActions in lib/src/components/wall/TerminalContextView.tsx). In Chromium on Windows and Linux, which covers WebView2 and the VS Code webview, pressing ↑/↓ on a focused, closed select changes its value and fires change without opening the list. A keyboard user who tabs to "more…" and presses ↓ to see the options therefore launches the first overflowed target: a Pane opens and the context dismisses. The value resets to "", so each further arrow press does it again. Mouse users and macOS, where the arrow key opens the popup, are unaffected. The context is meant to be keyboard-driven ("Must focus context controls on opening" in docs/specs/layout.md), so this needs a fix. Two options: act only on Enter or on mouse selection from the open list, or replace the select with a button-triggered menu.

nedtwigg and others added 2 commits September 28, 2026 21:47
…trigger

In Chromium on Windows and Linux, arrow keys and type-ahead change a closed
select's value and fire `change`, so a keyboard user tabbing to "more…" and
pressing ↓ launched the first overflowed target. Keys that would change the
closed select now do nothing, and ↑/↓ open the list with `showPicker()`.

WebKit counted the transparent select's option text as overflow past the
trigger, failing the narrow stories' fit checks; the trigger now clips it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Display modal's Emulate dropdown was the only caller of
`ScreenActions.applyDevice` → `BrowserHandle.device` → `{ op: 'device' }`
and the device branches in the browser, agent-browser, and Playwright
hosts. Device emulation stays with the CLI (`dor agent-browser set device`,
`dor playwright`), which calls the provider directly. The spec rules that
described the webview path go with it, as does `DimInput`'s `disabled`
prop, which only device mode used.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@nedtwigg

Copy link
Copy Markdown
Member Author

On the "more…" dropdown keyboard finding (review on 117648d): fixed in ab286c3, taking the first option. A launch now happens only on a choice from the open list.

  • A key that would change the closed select's value (arrows, Home/End/Page keys, type-ahead) is preventDefaulted.
  • ↑/↓ open the list with showPicker() instead. If that throws, Space and Alt+↓ still open it natively.
  • Tab, Enter, Space, Escape, F4 and modified keys pass through, so the context's Tab and Escape handling is unchanged.
  • The rule is now in docs/specs/layout.md → "Header context menu".
  • It is pinned by opens the overflow list from the keyboard rather than letting keys pick its first entry in TerminalContext.test.tsx, which fails with the preventDefault removed. I checked that by mutating the fix.

The same commit fixes the WebKit play failures in the narrow TerminalContext stories. WebKit counted the transparent select's option text as overflow past the "more…" trigger, and the trigger now clips it. The TerminalContext, AgentBrowserScreenModal and BrowserChromeHeader stories pass in both Chromium and WebKit locally.

The directory's copy is now an unlabeled icon right after the path, like
the Surface ref's, and confirms with the check alone. When the row runs
out of room, "open in Finder" drops to its icon (and its busy state to the
spinner), and only then does the path truncate, from its start, so its
end stays visible. The port row's width measurement moves into a shared
`useRowFit`, and the gallery's play check now holds the Dir row to one
line alongside Ports.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dormouse-bot
dormouse-bot previously approved these changes Sep 29, 2026
As the row narrows, "explain" drops to its icon, the title truncates to
eight characters, the Surface ref drops to its copy icon (its tooltip and
accessible name, now "Copy surface:N", keep the ref), and only then does
the title truncate further. The row shares `useRowFit` with Dir and Ports,
and the gallery's play check holds it to one line with them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Title row's fit can go stale when the helper-placement buttons change. Details inline.

Comment thread lib/src/components/wall/TerminalContextView.tsx
@dormouse-bot
dormouse-bot dismissed their stale review September 29, 2026 05:25

Superseded by the review on a later commit.

The fit reads the header actions' width, but only the row and its
measurer were observed, so a placement side coming or going without the
context resizing left the ladder stale. `useRowFit` now also observes
elements whose width a fit reads, and the Title row passes its actions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@nedtwigg
nedtwigg merged commit 750b5af into main Sep 29, 2026
17 checks passed
@nedtwigg
nedtwigg deleted the simplify/browser-viewport-controls branch September 29, 2026 05:40

This branch is waiting to be deployed

1 waiting deployment
hosted-preview — ec30d3df Waiting Sep 29, 2026 by nedtwigg via cleanup #522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants