Skip to content

fix(preview): isolate keyboard focus during automation and indicate active focus (#647) - #710

Merged
rynfar merged 1 commit into
pylonfrom
fix/issue-647-preview-focus-isolation
Sep 21, 2026
Merged

rynfar merged 1 commit into
pylonfrom
fix/issue-647-preview-focus-isolation

Conversation

@rynfar

@rynfar rynfar commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #647

Summary

  1. Host webview focus deflection: While an agent is driving automation (controller === "agent"), any focus event received by the host <webview> element immediately blurs the webview and redirects focus to the host composer via dispatchSnapShotComposerFocus(). If the controller transitions to agent while the webview was focused, or transitions back from agent to user, focus is restored to the host composer. The guest page's CDP automation typing/clicking continues unimpeded without physical user keystrokes inadvertently leaking into the guest DOM input.
  2. Main process focus restoration: When an automation control action finalizes in Manager.ts, focus is restored to the main window's webContents.
  3. Visual focus indicator: Added usePreviewFocus hook and data-preview-focused attribute with a subtle active focus ring (ring-1 ring-inset ring-ring/60) on PreviewView to visually display when the preview holds keyboard focus.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@vercel

vercel Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
pylon-marketing Ignored Ignored Preview Sep 21, 2026 3:58pm UTC

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 14.0 KiB 14.0 KiB +5 B (+0.0%) 15.1 KiB ✅
Codex Thread snapshot wire 7.2 KiB 7.2 KiB +4 B (+0.1%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.7 KiB 6.7 KiB +1 B (+0.0%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 58.0 KiB 58.0 KiB 0 B (0.0%) 66.4 KiB ✅
Codex Live turn messages 9 9 0 (0.0%) 21 ✅
Claude Total thread wire 14.0 KiB 14.0 KiB −2 B (−0.0%) 15.1 KiB ✅
Claude Thread snapshot wire 7.2 KiB 7.2 KiB +3 B (+0.0%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.7 KiB 6.7 KiB −5 B (−0.1%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 58.9 KiB 58.9 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 9 9 0 (0.0%) 21 ✅

Baseline: de96f49 · PR result: 99c689c · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 115.6 KiB
  • Claude decoded thread snapshot: 116.3 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@rynfar
rynfar merged commit a1663cc into pylon Sep 21, 2026
19 checks passed
@rynfar
rynfar deleted the fix/issue-647-preview-focus-isolation branch September 21, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typing while an agent drives the preview can land in the preview's focused input

1 participant