feat(web): copy branch name via right-click in the branch selector#4275
Conversation
Right-clicking the branch trigger below the composer or any ref row in the picker now shows a "Copy branch name" context menu (native on desktop, DOM fallback on web) instead of the browser's default menu, so branch names can be copied for cloning/checkout elsewhere. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved Simple UI feature adding right-click copy functionality to the branch selector. Uses existing clipboard and context menu utilities with no complex logic or side effects beyond the intended behavior. You can customize Macroscope's approvability policy. Learn more. |
The disabled trigger Button has pointer-events-none, so right-clicks never reached the context-menu handler during ref loading or branch actions. Move the handler to a wrapper span around the trigger. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Dismissing prior approval to re-evaluate f9749bf
Problem
Right-clicking the branch name below the composer (or any ref in the branch picker) showed the browser's default Cut/Copy/Paste menu with everything disabled, so there was no way to copy a branch name for cloning or checking out elsewhere.
Fix
Right-clicking the branch selector trigger or any branch row in the ref picker now opens a Copy branch name context menu, using the existing
localApi.contextMenu.showplumbing (native menu on desktop, DOM fallback on web — same as tab and sidebar context menus). Copying uses the sharedwriteTextToClipboardhelper and reports success/failure via toast, matching the "Copy path" behavior on right-panel tabs.Verification
pnpm typecheck(apps/web) passes.pnpm lintclean for the touched file (remaining warnings are pre-existing elsewhere).🤖 Generated with Claude Code
Note
Low Risk
Isolated UI in the branch selector; reuses established context-menu and clipboard patterns with no auth, data, or VCS checkout logic changes.
Overview
Right-click on the active branch trigger or any ref row in the branch picker now opens a Copy branch name context menu (via
localApi.contextMenu.show, same as sidebar and right-panel tabs). The chosen ref is copied withwriteTextToClipboard, with success and error toasts aligned with existing copy-path behavior.The combobox trigger is wrapped in a
spanthat ownsonContextMenuso copy still works while the trigger button is disabled during ref load or pending branch actions (pointer-events-noneon the button would otherwise block right-clicks). Create-ref and checkout-PR rows are unchanged.Reviewed by Cursor Bugbot for commit f9749bf. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add right-click context menu to copy branch name in the branch selector
onContextMenuhandlers to each branchComboboxItemand to a wrapper around theComboboxTriggerinBranchToolbarBranchSelector.tsx.writeTextToClipboardand shows a success or error toast.pointer-events-none).Macroscope summarized f9749bf.