Repository navigation
fix: suppress modifier-click node selection in ordinary text - #655
Merged
Merged
Conversation
Azganoth
added a commit
that referenced
this pull request
Oct 10, 2026
## Summary Ctrl-click (Cmd-click on macOS) on a rendered link, wiki link, or footnote reference did nothing. A real press moves the native caret into the target on mousedown; the editor reads that selection, source projection replaces the rendered target with its Markdown, and no click reaches it. In a table cell, ProseMirror's modifier node selection also outlined the cell's paragraph. - The link activation, wiki-link navigation, and footnote navigation plugins cancel a primary-modifier mousedown on their own target. The caret stays put, ProseMirror skips its mouseup node selection, and the click activates the target. Plain clicks still place the caret and open the source. - The Vitest and desktop E2E Ctrl-click helpers now model the press default: unless mousedown is cancelled, the caret moves to the pressed position before mouseup, and no click follows once the pressed element has left the document. The previous helpers dispatched untrusted events, which have no default action, so the #655 scenario passed while links stayed broken. ## Related Issue Closes #650 ## Verification - `pnpm exec vitest run` on the link activation, wiki link, footnote navigation, block selection (Windows and simulated macOS), and source projection suites passed. The full-sequence cases cover web and local Markdown targets, mixed-format labels, reference links, links in lists, blockquotes, and table cells, wiki links, footnote references, and Meta-click on macOS; they fail on `main` and pass with the fix. - `pnpm check:frontend` and `git diff --check` passed. Manually verified in headless Edge on Windows, with trusted CDP mouse input against the editor mounted at a temporary Vite route and a stubbed Tauri `invoke`: 1. Ctrl-click on inline, local, mixed-format, reference, quoted, and table-cell links, a wiki link, and a footnote reference reproduced the defect on `main` and, with the fix, activated each target without projecting its source or selecting a node. 2. Plain clicks on the same targets still placed the caret and opened their source. 3. The desktop helper's page-side sequence reproduced the same failures on `main` and passed with the fix. Not verified: the updated `block-selection` and `wiki-links` desktop scenarios were not run locally and are left to CI, and the helper's later switch to `caretPositionFromPoint` is type-checked only. No hardware mouse input in the Tauri app and no native macOS run. ## Notes Footnote-reference `Mod+click` navigation shared the cause and is fixed here although #650 names only links. Help describes where links open but not the gesture, so it is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ctrl-clicking a paragraph or heading could trigger ProseMirror's outlined node selection. Keep ordinary text clicks as caret placement, including when Ctrl/Cmd is released before mouseup, while preserving structural selection and modifier-click link activation.
Capture the modifier on mousedown because ProseMirror decides node selection on mouseup. Keep rendered link targets available until their click handler activates them.
Related Issue
Closes #648
Verification
pnpm exec vitest run src/features/editor/plugins/blockSelectionInteraction.test.ts src/features/editor/plugins/blockSelectionModifierClickMac.test.ts src/features/editor/plugins/linkActivation.test.tspassed. Complete mouse sequences check Windows Ctrl and simulated macOS Cmd, caret placement, source preservation, and selection/link interaction boundaries.pnpm build:e2e:desktopand the Windows desktopblock-selectionscenario passed. The scenario checks rendered caret placement, link activation, atomic selection, and structural interactions. Invocation:pnpm exec tsx e2e/desktop/run.issue648.ts --scenario block-selection; this temporary copy of the runner changed only the driver port to 4648 for isolation.pnpm check:frontend,pnpm lint:frontend,pnpm exec oxfmt --check, andgit diff --checkpassed.Not verified: hardware mouse input or a native macOS run. Desktop modifier tests dispatch the complete DOM mouse sequence at rendered coordinates because the embedded driver omits modifier flags from pointer actions.