[Bug]: FloatingComposer collapses on click near bottom due to popover repositioning blur #6227
Open
1 task done
Labels
Category: Open Source
The issue or pull reuqest is related to the open source packages of Tiptap.
Type: Bug
The issue or pullrequest is related to a bug
Affected Packages
@liveblocks/react-tiptap
Version(s)
2.2
Bug Description
When using @liveblocks/react-tiptap with FloatingComposer and FloatingThreads, clicking “Reply to thread” near the bottom of the editor causes the input to appear momentarily and then collapse. This is due to the popover repositioning on open, which causes a focus shift or blur event that collapses the composer.
📦 Packages Involved
"@tiptap/extension-bold": "^2.4.0",
"@tiptap/extension-bubble-menu": "^2.6.2",
"@tiptap/extension-bullet-list": "^2.4.0",
"@tiptap/extension-collaboration": "^2.11.5",
"@tiptap/extension-collaboration-cursor": "^2.11.5",
"@tiptap/extension-color": "^2.4.0",
"@tiptap/extension-highlight": "^2.3.0",
"@tiptap/extension-italic": "^2.4.0",
"@tiptap/extension-link": "^2.3.0",
"@tiptap/extension-list-item": "^2.4.0",
"@tiptap/extension-ordered-list": "^2.4.0",
"@tiptap/extension-table": "^2.4.0",
"@tiptap/extension-table-cell": "^2.4.0",
"@tiptap/extension-table-header": "^2.4.0",
"@tiptap/extension-table-row": "^2.4.0",
"@tiptap/extension-text-style": "^2.4.0",
"@tiptap/extension-underline": "^2.4.0",
"@tiptap/pm": "^2.3.0",
"@tiptap/react": "^2.11.5",
"@tiptap/starter-kit": "^2.11.5",
🧪 Steps to Reproduce
Set up a collaborative editor with useEditor and useLiveblocksExtension.
Add FloatingComposer and FloatingThreads.
Scroll to the bottom of the editor.
Click "Reply to thread" on a comment at the bottom of the editor.
The input opens and immediately closes due to blur.
Expected Behavior
The reply input should remain open and focused so the user can type their reply, regardless of the editor's scroll position.
Actual Behavior
When the thread is near the bottom of the editor, clicking "Reply to thread" triggers the input, which quickly collapses due to a blur event. If the input is rendered higher up in the DOM, this does not occur. If you hold the click and move the cursor in the input, it holds it open.
Analysis
The issue seems to be caused by popover repositioning logic.
The repositioning of the composer on open likely moves the DOM node, which steals focus or misaligns the pointer just enough to fire a blur.
Holding the click (long press) sometimes keeps the input open, suggesting this is timing-sensitive.
Attempts to Fix
Attempted to force display by collapsing the reply to input, (actually at this point i would just be happy if i could show the un-collapsed reply to, as it would solve this annoying bug)
Attempted to force with CSS without luck
Attempted to add "defaultCollapsed and collapsed props in the FloatingComposer" without luck
Attempted to see if we can set the default "focused" state on open
Thanks everyone!
Browser Used
Chrome
Code Example URL
No response
Expected Behavior
The reply input should remain open and focused so the user can type their reply, regardless of the editor's scroll position.
Additional Context (Optional)
When using @liveblocks/react-tiptap with FloatingComposer and FloatingThreads, clicking “Reply to thread” near the bottom of the editor causes the input to appear momentarily and then collapse. This is due to the popover repositioning on open, which causes a focus shift or blur event that collapses the composer.
Dependency Updates
The text was updated successfully, but these errors were encountered: