Skip to content

fix(super-editor): insert mentions on first click - #3879

Merged
caio-pizzol merged 4 commits into
superdoc:v1from
malizhev:fix/mention-popover-first-click
Aug 10, 2026
Merged

fix(super-editor): insert mentions on first click#3879
caio-pizzol merged 4 commits into
superdoc:v1from
malizhev:fix/mention-popover-first-click

Conversation

@malizhev

@malizhev malizhev commented Aug 7, 2026

Copy link
Copy Markdown

Summary

  • Prevent mention user rows from transferring focus or triggering the document-level selection handler on mousedown.
  • Keep the existing mention popover mounted until its click handler inserts the selected user.
  • Correct the internal inserMention prop typo to insertMention in the mention component and its caller.
  • Add regression coverage for inserting a mention on the first click.

Why

Clicking a user in the mention popover currently requires two clicks. The first mousedown reaches the document-level custom-selection handler, which reapplies the editor state. Because the popover is still marked for an update, this remounts Mentions.vue before the browser can dispatch click to the original row.

Closes #3878

Review in cubic

Prevent mention row mousedown events from reaching the document-level
selection handler, which remounted the popover before click could fire.

Closes superdoc#3878

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@caio-pizzol

Copy link
Copy Markdown
Contributor

Hey @malizhev, thanks for the fix! We reproduced the issue and confirmed that the implementation fixes first-click mention insertion.

I pushed a small follow-up to your branch so the regression test mounts into document.body. This ensures the test actually verifies that mousedown does not reach the document listener. Without it, the test stayed green even if .stop was removed.

The focused mention and popover tests are passing. Thanks again!

@caio-pizzol
caio-pizzol enabled auto-merge (squash) August 10, 2026 16:23
@superdoc superdoc deleted a comment from qodo-code-review Bot Aug 10, 2026
@caio-pizzol
caio-pizzol disabled auto-merge August 10, 2026 17:14
@caio-pizzol
caio-pizzol merged commit 8def7e0 into superdoc:v1 Aug 10, 2026
52 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mention popover requires two clicks to insert a user

2 participants