Skip to content

fix(shared-notes): prevent collaboration cursor name from leaking into links - #25285

Merged
ramonlsouza merged 4 commits into
bigbluebutton:v3.0.x-developfrom
Tainan404:i-25225-blocknote-cursor-in-link
Jun 23, 2026
Merged

ramonlsouza merged 4 commits into
bigbluebutton:v3.0.x-developfrom
Tainan404:i-25225-blocknote-cursor-in-link

Conversation

@Tainan404

Copy link
Copy Markdown
Member

What does this PR do?

In the BlockNote shared notes editor, when one user puts their text cursor inside a link, their collaboration‑cursor name was rendered inside the <a> for everyone else — wrapped in invisible U+2060 word‑joiner characters. Copying or reading the link then gave a broken URL with the name spliced into it (e.g. …/issues/ + Firstname Lastname + 25175).

The remote cursor is a ProseMirror widget that y‑prosemirror places without a marks override, so inside a link it inherits the link mark. y‑prosemirror exposes no hook for that, so the fix uses BlockNote's supported renderCursor hook: the name is now held in a data-cursor-name attribute and shown via CSS ::after (never as document text), and the U+2060 separators are dropped. The cursor still shows normally as a presence badge — only the leaked text is gone, so the link's text and href stay clean.

Also adds a two‑user Playwright regression test for BlockNote shared notes.

Closes Issue(s)

Closes #25225

How to test

  1. Two users (A and B) in a meeting with shared notes open (BlockNote editor).
  2. B pastes/types a link; A places their caret inside that link.
  3. Before: B sees A's name embedded in the link, and copying it yields the URL with A's name spliced in. After: the link text/href are clean and A's name shows only as a floating cursor badge.

Automated: bigbluebutton-tests/playwright/sharednotes/blocknote/blocknote.spec.ts (2‑user) — fails on an unpatched build, passes with this fix.

More

  • Fixed in our integration layer (renderCursor) rather than patching y‑prosemirror; a future upstream marks: [] fix could replace it.
  • Render‑only change: no document/Yjs content or href is altered, and the name is a text node (not HTML), so this is not an XSS.

…o links

In the BlockNote shared notes editor, y-prosemirror renders the remote
collaboration cursor as a ProseMirror widget decoration with `side: 10` and
no `marks`, so ProseMirror wraps the widget in the marks of the node that
follows the caret. When a remote user's caret sits inside a link, that node
carries the `link` mark, so the cursor — including the user's name and the
U+2060 word-joiner separators around it — was rendered inside the <a>,
leaking the name into the link's visible text (issue bigbluebutton#25225).

Render the cursor through BlockNote's supported `renderCursor` hook so the
element carries no document text: the collaborator's name is held in a
`data-cursor-name` attribute and shown as CSS `::after` pseudo-content
(never part of `textContent`/`href`), and the U+2060 separators are dropped.
Presence rendering (caret + name label, including the activity/hover label)
is preserved.

Adds a two-user Playwright regression test that places one user's cursor
inside a link and asserts the other user's view of that link contains no
collaborator name and no word-joiner separators in its text or href.

Co-authored-by: Tainan Felipe <[email protected]>
…view

- Assert the remote cursor is positioned inside the link (the precondition
  that proves the bug condition is actually exercised — guards against a
  false pass on a clean-but-cursorless link).
- Poll for the remote cursor instead of a fixed sleep (robust; still reads
  via page.evaluate so the cursor owner's editor keeps focus and keeps
  broadcasting its cursor).
- Count only `.bn-collaboration-cursor__base` (one per cursor) and drop the
  unused `hasAnchor` field.
- Add a TODO pointing at the upstream y-prosemirror `marks: []` fix.

Co-authored-by: Tainan Felipe <[email protected]>
…ministic

The click-based caret positioning was flaky: clicking the link opens
BlockNote's link toolbar, which steals editor focus and stops y-prosemirror
from broadcasting the moderator's cursor — so the attendee sometimes saw the
cursor at the link's end (outside the <a>) and the test failed on the
precondition instead of reaching the bug assertion.

Place the caret inside the link by keyboard only, and fold the presence
guard + inside-link precondition + sync wait into a single
expect.poll(cursorWidgetInsideLink).toBe(true).

Verified: RED on an unpatched 3.0 server (fails on the U+2060 assertion,
reproducing bigbluebutton#25225) and GREEN on the patched build.

Co-authored-by: Tainan Felipe <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 387123b6-edee-48d8-9207-a7a3e1ef25fe

📥 Commits

Reviewing files that changed from the base of the PR and between 6df858d and 504f1e9.

📒 Files selected for processing (2)
  • bigbluebutton-tests/playwright/sharednotes/blocknote/blocknote.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/util.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • bigbluebutton-tests/playwright/sharednotes/blocknote/util.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/blocknote.ts

Walkthrough

This PR fixes issue #25225 where a remote collaborator's name was being injected as a text node into link DOM elements in the BlockNote shared notes editor. The fix introduces a custom renderCollaborationCursor function in component.tsx that stores the collaborator name in a data-cursor-name HTML attribute on the cursor DOM element instead of as inline text, and updates the component's inline CSS to display that name via a ::after pseudo-element using attr(data-cursor-name). The renderCursor option in BlockNote's collaboration config is updated to use this custom renderer. A new Playwright regression test suite is added with a BlockNoteSharedNotes class, helper utilities for the BlockNote editor, and a test that verifies a link's visible text and href are unmodified when a remote user's cursor widget is positioned inside the link.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • GuiLeme
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: preventing collaboration cursor names from leaking into links, which is the primary objective of this PR.
Description check ✅ Passed The description is well-related to the changeset, explaining the bug, the root cause, the fix approach, and how to test it.
Linked Issues check ✅ Passed The PR directly addresses issue #25225 by implementing a fix that prevents collaborator names from being embedded in link text/href, which was the core requirement.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the issue: component rendering changes for cursor display, regression test implementation, and test utilities.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Tainan404 Tainan404 changed the title I 25225 blocknote cursor in link fix(shared-notes): prevent collaboration cursor name from leaking into links Jun 17, 2026
@ramonlsouza
ramonlsouza requested a review from GuiLeme June 17, 2026 18:38
@ramonlsouza ramonlsouza added this to the Release 3.0 milestone Jun 17, 2026

@GuiLeme GuiLeme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix is working fine. I could not reproduce the bug manually, but it does fail the regression tests when ran against a server without the fix.

…test

Define WORD_JOINER once in util.ts and import it in blocknote.ts instead
of declaring the same value in both files. The util.ts copy lived inside a
page.evaluate (browser scope), so it is now passed into the evaluate as an
argument. Addresses review feedback on PR bigbluebutton#25285.
@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@GuiLeme
GuiLeme self-requested a review June 22, 2026 20:19

@GuiLeme GuiLeme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@ramonlsouza
ramonlsouza merged commit 9832cf4 into bigbluebutton:v3.0.x-develop Jun 23, 2026
35 checks passed
@sonarqubecloud

Copy link
Copy Markdown

@ramonlsouza ramonlsouza mentioned this pull request Jul 1, 2026
8 tasks done
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.

BlockNote - if someone clicks on a link, their name is embedded in the link

3 participants