Skip to content

fix(react, vue-2, vue-3): added shadow root remount logic to the framework integrations - #8146

Open
NicolaiHorlacher wants to merge 2 commits into
ueberdosis:mainfrom
NicolaiHorlacher:fix/shadow-dom-component-remount
Open

fix(react, vue-2, vue-3): added shadow root remount logic to the framework integrations#8146
NicolaiHorlacher wants to merge 2 commits into
ueberdosis:mainfrom
NicolaiHorlacher:fix/shadow-dom-component-remount

Conversation

@NicolaiHorlacher

@NicolaiHorlacher NicolaiHorlacher commented Jul 30, 2026

Copy link
Copy Markdown

Fixes

Fixes #8145

Changes and Review

EditorContent moves the live editor DOM between elements on mount, but ProseMirror kept its cached root node pointing at the previous document or shadow tree - so after remounting a persistent editor into a shadow root, all selection handling talked to the discarded root and the cursor stopped following clicks.

Without a framework integration, keeping the ProseMirror root in sync is the user's responsibility. With EditorContent, Tiptap owns the DOM lifecycle, so it should handle this automatically.

Checklist

  • I have added a changeset if necessary.
  • I have added tests if possible.
  • I have made sure to test my changes myself.

Responsibility

  • I have reviewed and understand these changes, and I take responsibility for this PR, even if an AI agent created it.

@NicolaiHorlacher
NicolaiHorlacher requested a review from a team as a code owner July 30, 2026 13:55
@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6526a70

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 74 packages
Name Type
@tiptap/vue-3 Patch
@tiptap/vue-2 Patch
@tiptap/react Patch
@tiptap/extension-drag-handle-vue-3 Patch
@tiptap/extension-drag-handle-vue-2 Patch
@tiptap/extension-drag-handle-react Patch
@tiptap/core Patch
@tiptap/extension-audio Patch
@tiptap/extension-blockquote Patch
@tiptap/extension-bold Patch
@tiptap/extension-bubble-menu Patch
@tiptap/extension-bullet-list Patch
@tiptap/extension-code-block-lowlight Patch
@tiptap/extension-code-block Patch
@tiptap/extension-code Patch
@tiptap/extension-collaboration-caret Patch
@tiptap/extension-collaboration Patch
@tiptap/extension-color Patch
@tiptap/extension-details Patch
@tiptap/extension-document Patch
@tiptap/extension-drag-handle Patch
@tiptap/extension-emoji Patch
@tiptap/extension-file-handler Patch
@tiptap/extension-find-and-replace Patch
@tiptap/extension-floating-menu Patch
@tiptap/extension-font-family Patch
@tiptap/extension-hard-break Patch
@tiptap/extension-heading Patch
@tiptap/extension-highlight Patch
@tiptap/extension-horizontal-rule Patch
@tiptap/extension-image Patch
@tiptap/extension-invisible-characters Patch
@tiptap/extension-italic Patch
@tiptap/extension-link Patch
@tiptap/extension-list Patch
@tiptap/extension-mathematics Patch
@tiptap/extension-mention Patch
@tiptap/extension-node-range Patch
@tiptap/extension-ordered-list Patch
@tiptap/extension-paragraph Patch
@tiptap/extension-ruby-text Patch
@tiptap/extension-strike Patch
@tiptap/extension-subscript Patch
@tiptap/extension-superscript Patch
@tiptap/extension-table-of-contents Patch
@tiptap/extension-table Patch
@tiptap/extension-text-align Patch
@tiptap/extension-text-style Patch
@tiptap/extension-text Patch
@tiptap/extension-twitch Patch
@tiptap/extension-typography Patch
@tiptap/extension-underline Patch
@tiptap/extension-unique-id Patch
@tiptap/extension-youtube Patch
@tiptap/extensions Patch
@tiptap/html Patch
@tiptap/markdown Patch
@tiptap/pm Patch
@tiptap/starter-kit Patch
@tiptap/static-renderer Patch
@tiptap/suggestion Patch
@tiptap/extension-character-count Patch
@tiptap/extension-dropcursor Patch
@tiptap/extension-focus Patch
@tiptap/extension-gapcursor Patch
@tiptap/extension-history Patch
@tiptap/extension-list-item Patch
@tiptap/extension-list-keymap Patch
@tiptap/extension-placeholder Patch
@tiptap/extension-table-cell Patch
@tiptap/extension-table-header Patch
@tiptap/extension-table-row Patch
@tiptap/extension-task-item Patch
@tiptap/extension-task-list Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Jul 30, 2026

Copy link
Copy Markdown

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 6526a70
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/6a6bc5d4994be7000796c94f
😎 Deploy Preview https://deploy-preview-8146--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary

Fixed React, Vue 2, and Vue 3 when the same editor instance is remounted into a different Shadow DOM root.

The integrations now call editor.view.updateRoot() after moving the ProseMirror DOM nodes, so ProseMirror stops using a stale cached root. This keeps the cursor/selection tracking working correctly after remounts (so clicks keep following the cursor).

Also added/expanded tests for React/Vue 2/Vue 3 that mount one shared Editor into multiple Shadow DOM trees and verify view.root / DOM root node are updated after remounting, with proper cleanup between tests. Finally, updated the changesets to publish patch releases for @tiptap/react, @tiptap/vue-2, and @tiptap/vue-3.

Walkthrough

React, Vue 2, and Vue 3 now refresh ProseMirror’s cached root when editor content moves between Shadow DOM trees. Tests verify remounting the same editor instance, and a changeset schedules patch releases.

Changes

Shadow DOM editor remount

Layer / File(s) Summary
Refresh ProseMirror roots
packages/react/src/EditorContent.tsx, packages/vue-2/src/EditorContent.ts, packages/vue-3/src/EditorContent.ts
Each framework calls editor.view.updateRoot() after moving the editor view into its component.
Validate remount behavior
packages/react/src/EditorContent.spec.ts, packages/vue-2/__tests__/EditorContent.spec.ts, packages/vue-3/__tests__/EditorContent.spec.ts, .changeset/spotty-shadows-heal.md
Tests remount one editor instance across separate shadow roots and verify the current root; the changeset schedules patch releases.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EditorContent
  participant EditorView
  participant ShadowRoot
  EditorContent->>ShadowRoot: Move editor view DOM nodes
  EditorContent->>EditorView: Call updateRoot()
  EditorView->>ShadowRoot: Resolve the current root node
Loading

Suggested labels: area: editor, area: react, area: vue, complexity: medium, impact: medium

Suggested reviewers: arnaugomez, bdbch

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Linked Issues check ✅ Passed The PR updates React, Vue 2, and Vue 3 to re-resolve the root on remount, matching #8145.
Out of Scope Changes check ✅ Passed The changes stay focused on the shadow-root remount fix, tests, and changeset with no clear unrelated edits.
Title check ✅ Passed The title clearly matches the main change: shadow root remount handling for React and Vue integrations.
Description check ✅ Passed The description follows the template with Fixes, Changes and Review, Checklist, and Responsibility sections filled out.

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.

@coderabbitai coderabbitai Bot added area: editor Editor behavior, commands, and transactions area: react React integration and components area: vue Vue integration and components impact: medium Affects some users or workflows labels Jul 30, 2026
@NicolaiHorlacher NicolaiHorlacher changed the title fix: added shadow root remount logic to the framework integrations fix(react, vue-2, vue-3): added shadow root remount logic to the framework integrations Jul 30, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 30, 2026
@coderabbitai coderabbitai Bot added the complexity: medium Moderate change, possibly multiple files label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: editor Editor behavior, commands, and transactions area: react React integration and components area: vue Vue integration and components complexity: medium Moderate change, possibly multiple files impact: medium Affects some users or workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Framework integrations don't handle remount of editor instances properly in Shadow DOM

1 participant