[FEATURE] Mods: expose the Desktop text-selection menu as a ui.render component
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
In the Code tab of the Claude desktop app, selecting text in the Claude Code transcript opens a floating action menu with actions such as Reply. Mods can't change that menu. RenderComponent in 2.1.295 has no member for it, so a ui.render hook can't add an action, remove one, or hide the menu. A mod can read the selection with $.ui.selection(), but it can't offer anything where the person made it.
So every change people want from this menu needs its own change in Claude Code. Open requests ask for a one-click explain action (#99157) and for pinned inline threads on a selection (#94714). A request for a Mark action that keeps a reading position (#87917) was closed automatically.
Proposed Solution
Add the selection menu as a ui.render component, for example SelectionMenu, on each surface that draws one. Its props would carry:
- the selected text and the transcript row's
requestId, as$.ui.selection()returns them - the menu's items, each with an ID and a label
A hook then works as it does for other components:
next(e)keeps the engine's menu as it is.- A tree of the hook's own, built from the items in
e.props, adds, removes, or reorders items. An added item is aButtonwhoseonPresscan call$.prompt.fill,$.model.fork,$.ui.copy, or anything else a mod can do. - An empty tree hides the menu for that selection.
Alternative Solutions
- A setting to turn the menu off covers removal only. Each new action would still need its own change in Claude Code.
- A keyboard shortcut (#95144) or a modifier-click (#98389) for Reply would complement the menu, but neither lets a mod add an action or hide the menu.
- There is no workaround today. A mod can register a command that acts on
$.ui.selection(), but the menu still opens on every selection, and the command isn't offered where the selection is.
Priority
Medium - Would be very helpful
Feature Category
Developer tools/SDK
Use Case Example
- Someone selects a passage in a long reply and wants to ask about just that passage. A mod adds an Explain item that opens a side chat with the selection quoted, as #99157 asks.
- Someone is interrupted halfway through a long reply. A mod adds a Mark item that records the row they stopped at, and a mod command scrolls back to it with
$.ui.scroll, covering #87917. - I select text as I read, to keep my place, and the menu opens on every one of those selections. A mod hides the menu, and selection keeps working as a place marker.
Additional Context
- Seen in Claude Code 2.1.295 in the desktop app's Code tab on Linux.
- Related: #99157, #94714, #87917, #95144, #98389.
_Drafted by Claude (Anthropic AI assistant)._