microsoft / microsoft/vscode

Markdown editor: Plain-clicking rendered links in Editing mode prevents caret placement

Open
#328,937 0 comments 0 reactions 1 assignee Claimed by @ulugbekna View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Description

In the experimental hybrid Markdown editor, rendered links behave like preview links even while the editor is in **Editing** mode. A normal click on a rendered link immediately opens its target (typically in a browser or new tab). This makes it awkward to place the caret in the link text or reveal and edit the Markdown source.

Editing mode should prioritize editing interactions. Opening a link can remain available through Cmd/Ctrl-click or another explicit action; ordinary click-to-open is reasonable in Locked mode.

## Reproduction Steps

1. Open a Markdown document in the experimental Markdown editor and switch to **Editing** mode.
2. Add or locate `[link](https://example.com)`.
3. Ensure the link is rendered (its block is not already active).
4. Ordinary-click the rendered `link` text, intending to place the caret or edit the link text.

## Expected

In Editing mode, an ordinary click places the caret/selects text and reveals the editable Markdown as appropriate. Opening the target requires Cmd/Ctrl-click or an explicit open action. In Locked mode, an ordinary click may open the target.

## Actual

The ordinary click immediately opens `https://example.com`, so the first interaction navigates away instead of placing the caret. Editing the link requires an indirect click elsewhere in the block before returning to the link.

## Root Cause

The current `LinkViewNode` interaction explicitly opens a primary click whenever the link block is inactive (`!blockActive`), regardless of the editor-wide Editing/Locked mode. Only after the block is active does it require Ctrl/Cmd. As a result, the rendered state of the individual block takes precedence over Editing mode.

## Additional Context

This is related to, but distinct from, #323280, which fixed links not opening at all, and #326663, which concerns when link source expands during click-drag selection. The requested behavior is mode-sensitive: ordinary clicks should edit in Editing mode and may open in Locked mode.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.