Skip to content

Fix link clicks in markdown triggering parent tree item actions#275495

Merged
mjbvz merged 2 commits intomainfrom
copilot/add-session-view-for-pr
Nov 13, 2025
Merged

Fix link clicks in markdown triggering parent tree item actions#275495
mjbvz merged 2 commits intomainfrom
copilot/add-session-view-for-pr

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

Clicking links in markdown-rendered tree item descriptions (e.g., PR numbers in Agent Sessions view) was triggering both the link action and the tree item's open action.

Changes

Added event.stopPropagation() to activateLink() in src/vs/base/browser/markdownRenderer.ts to prevent click events from bubbling to parent elements.

} finally {
    event.preventDefault();
    event.stopPropagation();  // Prevents tree item click handler from firing
}

Fixes #274477

Original prompt

This section details on the original issue you should resolve

<issue_title>Agent sessions single view: clicking on PR number opens session and PR description</issue_title>
<issue_description>Testing #274477

Clicking on the PR number on the description of a copilot agent session will first open the chat session in the editor and then open the PR description.

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Add event.stopPropagation() in activateLink to prevent click events
on markdown links from bubbling up to parent elements like tree items.

This fixes the issue where clicking a PR number in the Agent Sessions
view description would both open the PR (intended) and open the session
editor (unintended).

Co-authored-by: bpasero <[email protected]>
Copilot AI changed the title [WIP] Add functionality to open session and PR description Fix link clicks in markdown triggering parent tree item actions Nov 5, 2025
Copilot AI requested a review from bpasero November 5, 2025 08:45
@bpasero bpasero closed this Nov 6, 2025
@bpasero
Copy link
Member

bpasero commented Nov 6, 2025

@mjbvz fyi this is an interesting attempt by Copilot to fix an issue where if markdown is rendered in a tree/list, clicking a link of that markdown would propagate as click up to the tree/list and also trigger that widgets default action. I am too scared to take this change in, but I wonder if its an oversight in the markdown renderer that it would not prevent bubbling when a link handles the click?

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 6, 2025

Hm this does look like it may be right but I'd like more testing. Let's revisit in November

@mjbvz mjbvz reopened this Nov 6, 2025
@mjbvz mjbvz assigned mjbvz and unassigned bpasero Nov 6, 2025
@mjbvz mjbvz self-requested a review November 6, 2025 18:56
@mjbvz mjbvz added this to the November 2025 milestone Nov 6, 2025
@mjbvz mjbvz marked this pull request as ready for review November 13, 2025 18:02
Copilot AI review requested due to automatic review settings November 13, 2025 18:02
@mjbvz mjbvz enabled auto-merge November 13, 2025 18:02
@mjbvz mjbvz merged commit 6467aa0 into main Nov 13, 2025
31 of 32 checks passed
@mjbvz mjbvz deleted the copilot/add-session-view-for-pr branch November 13, 2025 18:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where clicking on links within markdown-rendered tree item descriptions would trigger both the link navigation and the parent tree item's default action. The fix prevents event bubbling by adding event.stopPropagation() to the link activation handler.

Key changes:

  • Added event.stopPropagation() to prevent click events from propagating to parent elements after link activation

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Dec 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent sessions single view: clicking on PR number opens session and PR description Test: agent sessions single view

4 participants