Skip to content

Open chat links on left-click only and offer Copy link - #2081

Merged
realtonyyoung merged 2 commits into
mainfrom
capacitor/agent-6dfa48932fdd4d
Oct 29, 2026
Merged

realtonyyoung merged 2 commits into
mainfrom
capacitor/agent-6dfa48932fdd4d

Conversation

@realtonyyoung

@realtonyyoung realtonyyoung commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #2080 — AI-4684

What & why

MarkView raises LinkClicked on the release of any mouse button, so a right-click on a chat link launched the browser during the same release that opened the context menu. On macOS that froze the app. Now only a left-button release opens a link. The chat menu gains a "Copy link" row, shown only when the click (or the keyboard's current link) is on a link.

Where to look

MarkdownView records the release button in a tunnel handler before MarkView's own release handler fires. A menu row can now be hidden rather than greyed.

Verification

  • New Right_clicking_a_link_offers_to_copy_it_without_opening_it fails without the guard (opened contains https://example.com/docs) and passes with it
  • Desktop app suite: 5129/5130 pass. The one failure, Uses_the_probed_terminal_PATH_not_the_process_PATH, reads the local shell PATH and is not touched by this change

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a “Copy link” option to the text context menu when right-clicking a link. Selecting it copies the link URL without opening the link.
    • When a context-menu request has no pointer position, the copy action uses the currently focused link when available.
  • Bug Fixes
    • Right-clicking a link no longer triggers its navigation action.
    • The “Copy link” option is hidden when the context menu is opened over plain text.

MarkView raises LinkClicked on any button's release, so the right-click that
opens the context menu also launched the browser beneath it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3a14be75-8a4e-40e4-a10a-da94fca6a5da
Commits

Reviewing files that changed from the base of the PR and between a43173f and 5556a65.

Files selected for processing: 2
  • src/Capacitor.App/Views/MarkdownView.cs
  • test/Capacitor.App.Tests.Unit/TextContextMenuTests.cs
Files skipped from review as they are similar to previous changes: 2
  • test/Capacitor.App.Tests.Unit/TextContextMenuTests.cs
  • src/Capacitor.App/Views/MarkdownView.cs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

MarkdownView now avoids opening links on non-left mouse releases and captures link URLs for context menus. The markdown context menu conditionally offers “Copy link,” which copies the captured URL. Unit tests cover right-clicking links and plain text.

Changes: Markdown link context menu

Layer / File(s) Summary
Link release handling and URL capture
src/Capacitor.App/Views/MarkdownView.cs
MarkdownView tracks non-left releases, resolves context-menu URLs from pointer targets or keyboard focus, and copies captured URLs when a clipboard is available.
Conditional Copy link menu item
src/Capacitor.App/Views/TextContextMenu.cs, test/Capacitor.App.Tests.Unit/TextContextMenuTests.cs
TextContextMenu shows “Copy link” only when a context URL exists. Tests verify copying a link without opening it and hiding the item for plain text.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Medium

Possibly related PRs

Suggested reviewers: nortonandreev, alexeyzimarev

Merge Risk: Minimal · up to 5556a

Link handling and Copy link behavior appear mergeable after normal checks.

Pre-merge checks: Passed 3
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Issue #2080 requires left-click link opening, right-click context-menu behavior without link opening, and a visible "Copy link" action for links. MarkdownView suppresses link execution for non-left …
Out of Scope Changes check Passed The changes stay within issue #2080. The menu visibility predicate, link capture, clipboard action, right-click helper update, and focused tests directly support the requested link and context-menu be…
Full details: Linked Issues check

Explanation

Issue #2080 requires left-click link opening, right-click context-menu behavior without link opening, and a visible "Copy link" action for links. MarkdownView suppresses link execution for non-left releases and captures the link for context-menu use. TextContextMenu shows the copy row only when a link exists, and CopyLinkAsync copies the URL. The added tests verify right-click behavior, clipboard content, and hiding the row for plain text.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #2080. The menu visibility predicate, link capture, clipboard action, right-click helper update, and focused tests directly support the requested link and context-menu behavior. No unrelated product change is identified in the supplied whole-PR summary.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@realtonyyoung
realtonyyoung marked this pull request as draft October 29, 2026 14:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@realtonyyoung
realtonyyoung marked this pull request as ready for review October 29, 2026 14:58
@realtonyyoung
realtonyyoung merged commit bebab59 into main Oct 29, 2026
13 checks passed
@realtonyyoung
realtonyyoung deleted the capacitor/agent-6dfa48932fdd4d branch October 29, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Right-clicking a chat link opens it and freezes the desktop app

1 participant