Skip to content

feat(web): copy branch name via right-click in the branch selector#4275

Merged
juliusmarminge merged 2 commits into
mainfrom
feat/copy-branch-name-context-menu
Jul 22, 2026
Merged

feat(web): copy branch name via right-click in the branch selector#4275
juliusmarminge merged 2 commits into
mainfrom
feat/copy-branch-name-context-menu

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Jul 22, 2026

Copy link
Copy Markdown
Member

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.show plumbing (native menu on desktop, DOM fallback on web — same as tab and sidebar context menus). Copying uses the shared writeTextToClipboard helper and reports success/failure via toast, matching the "Copy path" behavior on right-panel tabs.

  • Trigger button: copies the currently resolved active branch.
  • Picker rows: copies that row's ref name (works for local, remote, worktree, and default refs). The "create new ref" and "checkout PR" rows are unaffected.

Verification

  • pnpm typecheck (apps/web) passes.
  • pnpm lint clean 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 with writeTextToClipboard, with success and error toasts aligned with existing copy-path behavior.

The combobox trigger is wrapped in a span that owns onContextMenu so copy still works while the trigger button is disabled during ref load or pending branch actions (pointer-events-none on 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

  • Adds onContextMenu handlers to each branch ComboboxItem and to a wrapper around the ComboboxTrigger in BranchToolbarBranchSelector.tsx.
  • Right-clicking opens a native context menu with a 'Copy branch name' option; selecting it writes the branch name to the clipboard via writeTextToClipboard and shows a success or error toast.
  • The wrapper around the trigger captures right-clicks even when the button is disabled (which sets pointer-events-none).
  • Requires a local API to be available; the context menu is skipped otherwise.

Macroscope summarized f9749bf.

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>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 72efcd77-fb6e-4bfe-8063-32bd233df396

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/copy-branch-name-context-menu

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

@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 Jul 22, 2026
Comment thread apps/web/src/components/BranchToolbarBranchSelector.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 22, 2026
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>
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 22, 2026 21:13

Dismissing prior approval to re-evaluate f9749bf

@juliusmarminge
juliusmarminge merged commit 78a0ea5 into main Jul 22, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the feat/copy-branch-name-context-menu branch July 22, 2026 21:33
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.

2 participants