Skip to content

fix: suppress modifier-click node selection in ordinary text - #655

Merged
Azganoth merged 1 commit into
mainfrom
bug/modifier-click-selection
Oct 6, 2026
Merged

Azganoth merged 1 commit into
mainfrom
bug/modifier-click-selection

Conversation

@Azganoth

@Azganoth Azganoth commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

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.ts passed. Complete mouse sequences check Windows Ctrl and simulated macOS Cmd, caret placement, source preservation, and selection/link interaction boundaries.
  • pnpm build:e2e:desktop and the Windows desktop block-selection scenario 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, and git diff --check passed.

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.

@Azganoth Azganoth added the Bug Something isn't working label Oct 6, 2026 — with ChatGPT Codex Connector
@Azganoth Azganoth self-assigned this Oct 6, 2026
@Azganoth
Azganoth merged commit 766025a into main Oct 6, 2026
3 checks passed
@Azganoth
Azganoth deleted the bug/modifier-click-selection branch October 6, 2026 04:37
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Ctrl-click in ordinary text creates a separate outlined node selection

1 participant