Agentic UI: add a native text context menu - #4388
Conversation
…ok up Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📊 Performance Test ResultsComparing 6432fd3 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
bcotrim
left a comment
There was a problem hiding this comment.
Looks good!
Some comments:
- On the composer only "Paste" is available, should we also offer "Copy"?
-
"Copy All" is a translated string. Should the other options also be translated?
menu.ts:364-366already does{ label: __( 'Copy' ), role: 'copy' }— macOS
localizes roles natively, so this would only show on Windows/Linux. -
conversation/index.tsx:473usescopyText ?? text, butcopyTextis only set on
the last text block (line 281). On a reply split by tool calls, right-clicking an
earlier paragraph makes "Copy All" copy just that fragment — the comment on line 262 says it should yield the whole message.
Suggestion: what do you think about an option to quote the selected text into the
composer? Could be useful for referencing part of the agent's reply. Could be done in a follow-up PR if you think it's a good idea
katinthehatsite
left a comment
There was a problem hiding this comment.
Nice work! I saw that the changes Bernardo mentioned were already implemented ❤️
I left some minor suggestions and a couple of questions but nothing that is blocking
|
@bcotrim thanks for the review.
I also added your suggestion to let users quote text into their composer. @katinthehatsite I implemented your suggestions as well! Let me know whatcha thinK! |
|
I am also seeing the same behavior as @bcotrim , I think it would make sense to clean that up as it does not seem to be necessary to have it on the buttons and other controls |
# Conflicts: # apps/ui/src/ui-classic/components/session-view/index.tsx
|
Good catch; should be fixed now. |

Related issues
How AI was used in this PR
AI wrote the implementation and tests from a scope I set interactively. I reviewed the approach, iterated on the menu behavior from review feedback, and tested it in the app.
Proposed Changes
Right-click previously did nothing in Studio’s Agentic UI because Electron does not provide Chromium’s browser context menu automatically. This adds a native operating-system menu while keeping browser builds on their existing browser-provided menu.
Copy All is message-level: assistant replies split by tool calls still copy all assistant text blocks. Tool details and tool output are not included. Code blocks retain their existing copy button, and the native menu’s Copy code action copies only the code block.
Quote in composer formats each selected line as a Markdown blockquote and leaves a blank line after it, with the composer focused and ready for the user to continue typing.
Every item is conditional on whether it can do something. Non-text inputs, read-only fields without a selection, unrelated controls, and empty canvas do not open an irrelevant menu. Undo, redo, cut, and delete remain deliberately outside this focused first pass.
Testing Instructions
This includes main-process code, so fully restart the app before testing.
Pre-merge Checklist
Notes for reviewers:
npm run typecheckpasses across all workspaces.npm run cli:build:uicompletes successfully.apps/uisuite pass: 71 files, 508 tests.