Skip to content

fix(desktop): enable context menus in the browser - #10670

Merged
juliusmarminge merged 3 commits into
mainfrom
fix-browser-context-menu
Sep 8, 2026
Merged

fix(desktop): enable context menus in the browser#10670
juliusmarminge merged 3 commits into
mainfrom
fix-browser-context-menu

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 8, 2026

Copy link
Copy Markdown
Member

Right-clicking inside an embedded browser tab or sign-in popup showed no native context menu. The menu handler was only installed on T3's main renderer.

Reuse that handler for attached browser contents and their popups. Editing actions focus the page that was clicked, spelling and image actions use its contents, and Electron receives the originating frame. Repeated attachment does not install duplicate handlers, and callbacks tolerate a closed browser tab.

Validation:

  • All 40 focused desktop-window and Electron-menu tests pass, covering tabs, popups, action targeting, disabled actions, duplicate attachment, and closed-tab callbacks.
  • Targeted lint passes.
  • Desktop typechecking passes with the repository's TypeScript 7 compiler.
  • All executed CI checks pass. Macroscope approved; CodeRabbit found no actionable code issues. Bugbot was unavailable because the team reached its spending limit.
  • CodeRabbit's generic docstring-coverage warning does not reflect a repository requirement. The native focus behavior is documented inline; adding comments that restate the installer would conflict with the repository's documentation guidance.
CleanShot.2026-09-07.at.21.34.15.mp4

Note

Enable context menus for host and guest contents in DesktopWindow

  • Replaces the single host-webContents context-menu listener with an installer tracking registered contents in a WeakSet.
  • Registers handlers for the host renderer, attached webview guests, and popup windows recursively.
  • Focuses the originating contents before showing editing roles, applying spelling and image actions to that specific contents object.
  • Passes an optional WebFrameMain to ElectronMenu for native popup calls.
  • Behavioral Change: Destroyed contents or owner windows no longer open a menu or execute contents-specific actions.

Macroscope summarized 267907e.

Summary by CodeRabbit

  • New Features

    • Context menus now work consistently in the main window, embedded web content, and popup windows.
    • Menu actions such as copy, paste, spelling corrections, link handling, and image copying are preserved across supported content.
    • Context menus now focus the content that triggered them, providing more reliable editing and selection behavior.
  • Bug Fixes

    • Prevented duplicate context-menu handlers.
    • Avoided showing or processing menus after window content has been closed.
    • Improved context-menu behavior for browser guests and sign-in popups.

Model: GPT-6. Harness: Codex.

Closes discussions

@cursor

cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 8, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Sep 8, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 267907e

Macroscope's review found this PR approvable — The production change is localized to Electron’s existing context-menu path, extending it to embedded browser guests and popups while preserving action targeting and adding lifecycle guards. Optional frame plumbing is backward-compatible, and focused tests cover registration, targeting, duplicate attachment, and closed contents.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All clear

Posted via Macroscope — Effect Service Conventions

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 11.3 KiB 13.6 KiB +2.3 KiB (+20.2%) 15.1 KiB
Codex Thread snapshot wire 5.5 KiB 7.0 KiB +1.6 KiB (+29.0%) 7.3 KiB
Codex Live turn WebSocket wire 5.9 KiB 6.6 KiB +719 B (+12.0%) 7.8 KiB
Codex Live turn WebSocket decoded 49.7 KiB 57.1 KiB +7.3 KiB (+14.7%) 66.4 KiB
Codex Live turn messages 16 10 −6 (−37.5%) 21
Claude Total thread wire 11.3 KiB 13.6 KiB +2.3 KiB (+19.9%) 15.1 KiB
Claude Thread snapshot wire 5.5 KiB 7.0 KiB +1.6 KiB (+28.6%) 7.3 KiB
Claude Live turn WebSocket wire 5.9 KiB 6.5 KiB +702 B (+11.7%) 7.8 KiB
Claude Live turn WebSocket decoded 50.6 KiB 57.8 KiB +7.3 KiB (+14.4%) 66.4 KiB
Claude Live turn messages 16 9 −7 (−43.8%) 21

Baseline: 83d769f · PR result: 267907e · 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: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

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

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 5b63af6b-8bc1-45ff-9a82-59f5131f10b9

📥 Commits

Reviewing files that changed from the base of the PR and between 6ba15c0 and c6e40f2.

📒 Files selected for processing (4)
  • apps/desktop/src/electron/ElectronMenu.test.ts
  • apps/desktop/src/electron/ElectronMenu.ts
  • apps/desktop/src/window/DesktopWindow.test.ts
  • apps/desktop/src/window/DesktopWindow.ts

Limit details: You’ve used all 10 included reviews currently available.


📝 Walkthrough

Walkthrough

DesktopWindow now installs native context menus for the host renderer, embedded browser guests, and popup windows. Menus focus the triggering contents, guard destroyed contents, preserve edit and copy actions, and forward popup frame context.

Changes

Native context-menu support

Layer / File(s) Summary
Popup frame contract
apps/desktop/src/electron/ElectronMenu.ts, apps/desktop/src/electron/ElectronMenu.test.ts
ElectronMenuTemplateInput accepts an optional WebFrameMain. popupTemplate forwards the frame to Menu.popup, with test coverage.
WebContents context-menu installation
apps/desktop/src/window/DesktopWindow.ts, apps/desktop/src/window/DesktopWindow.test.ts
DesktopWindow installs deduplicated listeners for host, embedded, and popup contents. The handler focuses contents, checks destruction state, preserves edit, spelling, image, and link actions, and passes frame context. Tests cover these paths and popup ownership.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to c6e40

Native context menus now work in embedded browser tabs and sign-in popups, with actions targeted to the originating content and safeguards for closed tabs. The covered behavior is ready to merge.

Sequence Diagram(s)

sequenceDiagram
  participant WebContents
  participant DesktopWindow
  participant ElectronMenu
  participant NativeMenu
  WebContents->>DesktopWindow: emit context-menu event
  DesktopWindow->>WebContents: focus triggering contents
  DesktopWindow->>ElectronMenu: create menu with frame
  ElectronMenu->>NativeMenu: open popup
  NativeMenu->>WebContents: execute edit or copy action
Loading

Suggested reviewers: stienswout, bil0000, maria-rcks

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: enabling native context menus in the desktop browser.
Description check ✅ Passed The description clearly explains what changed, why it changed, validation results, and the affected browser contents. It does not reproduce the template headings or checklist, and it does not provide …
  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-browser-context-menu

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@macroscopeapp
macroscopeapp Bot dismissed their stale review September 8, 2026 04:35

Dismissing prior approval to re-evaluate 63094c6

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Sep 8, 2026
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Sep 8, 2026
@juliusmarminge
juliusmarminge merged commit b5f7fa0 into main Sep 8, 2026
25 checks passed
@juliusmarminge
juliusmarminge deleted the fix-browser-context-menu branch September 8, 2026 04:56
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 8, 2026
## What's Changed
* fix(web): open proactive panels when entering threads by @maria-rcks in pingdotgg/t3code#10610
* fix(native): wait for the KDE feedback test listener by @juliusmarminge in pingdotgg/t3code#10645
* fix(desktop): resolve local media linked from remote threads by @maria-rcks in pingdotgg/t3code#10619
* fix(web): add bottom padding to project actions header by @flamboh in pingdotgg/t3code#10634
* fix(web): update machines together in auto balance by @maria-rcks in pingdotgg/t3code#10596
* fix(preview): transfer recordings to the agent environment by @maria-rcks in pingdotgg/t3code#10572
* fix(web): navigate markdown images as galleries by @maria-rcks in pingdotgg/t3code#10625
* chore: upgrade to TypeScript 7.0.2 by @juliusmarminge in pingdotgg/t3code#10663
* fix: hide email-bearing account labels in usage limits by @juliusmarminge in pingdotgg/t3code#10668
* fix(web): keep scroll-to-end button close to composer by @Bil0000 in pingdotgg/t3code#10543
* chore(deps): upgrade Effect to rc.112 and Alchemy to beta.76 by @juliusmarminge in pingdotgg/t3code#10652
* chore(refs): sync Effect reference to rc.112 by @juliusmarminge in pingdotgg/t3code#10653
* chore(refs): sync Alchemy reference to beta.76 by @juliusmarminge in pingdotgg/t3code#10654
* fix: generate thread titles with the selected model across connections by @Bil0000 in pingdotgg/t3code#10526
* fix(desktop): enable context menus in the browser by @juliusmarminge in pingdotgg/t3code#10670
* fix(desktop): stop generating declarations during bundling by @juliusmarminge in pingdotgg/t3code#10679
* fix(desktop): restore layout control hit targets by @juliusmarminge in pingdotgg/t3code#10673


**Full Changelog**: pingdotgg/t3code@v0.0.41-nightly.20260908.1377...v0.0.41-nightly.20260908.1387

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.41-nightly.20260908.1387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). 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.

1 participant