Skip to content

fix: require double-click to open editor links#259

Merged
rmolinamir merged 1 commit intomainfrom
feature/ux-improvements
Mar 29, 2026
Merged

fix: require double-click to open editor links#259
rmolinamir merged 1 commit intomainfrom
feature/ux-improvements

Conversation

@rmolinamir
Copy link
Copy Markdown
Contributor

Summary

  • Problem: Links inside the BlockNote editor were opening on single click, which interrupted editing flows.
  • Solution: Handle anchor interactions at the TipTap editor layer so single-click navigation is blocked and links open only on double-click.

Implementation

Updated useBlockEditor to pass custom _tiptapOptions.editorProps handlers:

  • Added a shared anchor-target helper that resolves a[href] from the event target.
  • Added handleClick to prevent default navigation for anchors on single click.
  • Added handleDoubleClick to open the link explicitly with window.open using noopener,noreferrer.

Verification

Verified locally with type-checking.

  • Checks: pnpm --filter @acme/web typecheck
  • Tests: TypeScript compile passed with no errors.

Notes

  • Risk Level: Low
  • Refactoring: No unexpected refactors
  • Assumptions: Anchor interactions should only navigate on double-click in editable BlockNote contexts.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
journl Building Building Preview, Comment Mar 29, 2026 10:29pm

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e67567c25d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +34 to +37
event.preventDefault();

// Block single-click navigation for links in the editor.
return true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Let ProseMirror handle link single-click selection

This handler consumes every anchor click by returning true, which in ProseMirror means the click is fully handled and downstream/default editor click logic will not run. That blocks normal caret/selection updates when users single-click linked text, so they can no longer reliably place the cursor in a link to edit it (a regression in editing behavior even though navigation is blocked).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is actually to make sure the Link menu opens on click:
image

Otherwise the whole formatting toolbar would open.

@rmolinamir rmolinamir merged commit b876b18 into main Mar 29, 2026
5 checks passed
@rmolinamir rmolinamir deleted the feature/ux-improvements branch March 29, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant