Repository navigation
fix(shared-notes): prevent collaboration cursor name from leaking into links - #25285
Conversation
…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]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThis PR fixes issue Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
GuiLeme
left a comment
There was a problem hiding this comment.
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.
✅ Automated tests have passed! |
|



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 invisibleU+2060word‑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
marksoverride, so inside a link it inherits the link mark. y‑prosemirror exposes no hook for that, so the fix uses BlockNote's supportedrenderCursorhook: the name is now held in adata-cursor-nameattribute and shown via CSS::after(never as document text), and theU+2060separators 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
Automated:
bigbluebutton-tests/playwright/sharednotes/blocknote/blocknote.spec.ts(2‑user) — fails on an unpatched build, passes with this fix.More
renderCursor) rather than patching y‑prosemirror; a future upstreammarks: []fix could replace it.