Fix link clicks in markdown triggering parent tree item actions#275495
Fix link clicks in markdown triggering parent tree item actions#275495
Conversation
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]>
|
@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? |
|
Hm this does look like it may be right but I'd like more testing. Let's revisit in November |
There was a problem hiding this comment.
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
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()toactivateLink()insrc/vs/base/browser/markdownRenderer.tsto prevent click events from bubbling to parent elements.Fixes #274477
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.