Skip to content

fix: command-mode highlight wraps the full pane for browser surfaces#164

Merged
nedtwigg merged 1 commit into
mainfrom
fix/browser-pane-command-mode-highlight
Jun 21, 2026
Merged

fix: command-mode highlight wraps the full pane for browser surfaces#164
nedtwigg merged 1 commit into
mainfrom
fix/browser-pane-command-mode-highlight

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Problem

Open a blank Dormouse, run dor ab open example.com (from a terminal you've typed in, so it splits), then enter command mode: the selection highlight around the browser pane was the wrong size and shape — ~30px short and shifted down — instead of wrapping the whole pane like a terminal's highlight does.

Root cause

Browser surfaces use dockview's renderer:'always' (required so the screencast canvas/iframe isn't moved on activation). That mounts the panel body in a dv-render-overlay layer that is a sibling of the dv-groupview elements and sits only over the content area, below the ~30px tab header.

resolvePaneElement resolves pane bounds by climbing to the nearest [class*="groupview"] ancestor. For terminals the body lives inside the groupview, so the climb finds the full group. For browser panes the climb finds nothing and falls back to the shorter overlay body — so the marching-ants highlight excluded the header strip.

Measured live: browser overlay {y:63, h:487} (body) vs. the full group {y:36, h:511}; a terminal in the same split gets {y:33, h:517} after inflation. The fix makes the browser highlight identical: {y:33, h:517}.

Fix

Add resolvePaneGroupElement(api, id, paneElements), which prefers the panel's authoritative group.element (the dv-groupview, correct for either renderer) and climbs the DOM only as a fallback for transient states where the panel isn't in the api yet. Resolved at measure-time, so it stays correct across re-parenting.

Routed the three consumers of the old resolution through it (same root cause):

  • WorkspaceSelectionOverlay — the reported command-mode highlight
  • findReattachNeighbor / findPaneInDirection — arrow-key spatial nav and door reattach
  • KillConfirmOverlay — modal centered over the pane being killed

Skill doc

Also documents in the debug-standalone-agent-browser skill that dor commands must be typed into the Dormouse instance under test, never run from your own shell — otherwise dor inherits the installed app's DORMOUSE_SURFACE_ID/control-socket env and targets the wrong instance, and an externally-run dor lacks caller-surface context (changing split-vs-replace behavior).

Verification

  • New spatial-nav.test.ts (5 cases: api group preferred, DOM-climb fallback, null api, disconnected group, no panel).
  • Full lib suite: 661 passed; tsc clean.
  • Verified live in the standalone agent-browser harness: in a terminal+browser split, both panes' command-mode highlights are now identical in size/shape (only x differs). Screenshot confirmed the border wraps the browser pane's URL-bar header + content.

🤖 Generated with Claude Code

Browser surfaces use dockview's `renderer:'always'`, which mounts the panel
body in a `dv-render-overlay` layer that sits only over the content area, with
no `dv-groupview` ancestor. The selection/spatial code resolved pane bounds by
climbing to the nearest groupview, so for browser panes it fell back to the
shorter body — the command-mode marching-ants highlight was ~30px short and
shifted down instead of wrapping the whole pane like a terminal.

Add `resolvePaneGroupElement`, which prefers the panel's authoritative
`group.element` (correct for either renderer) and climbs the DOM only as a
fallback. Route the selection overlay, spatial navigation, and kill-confirm
overlay through it.

Also document in the debug-standalone-agent-browser skill that `dor` must be
typed into the Dormouse instance under test, not run from your own shell — it
otherwise inherits the installed app's surface/socket env and targets the wrong
instance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6b8441d
Status: ✅  Deploy successful!
Preview URL: https://f80c5814.mouseterm.pages.dev
Branch Preview URL: https://fix-browser-pane-command-mod.mouseterm.pages.dev

View logs

@nedtwigg nedtwigg merged commit 60e82ec into main Jun 21, 2026
9 checks passed
@nedtwigg nedtwigg deleted the fix/browser-pane-command-mode-highlight branch June 21, 2026 06:35
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