Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: FloatingComposer collapses on click near bottom due to popover repositioning blur #6227

Open
1 task done
tstanescu1 opened this issue Apr 1, 2025 · 0 comments
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

Comments

@tstanescu1
Copy link

tstanescu1 commented Apr 1, 2025

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!

Image Holding the click on input shows properly, but a normal click collapses it right away. Only happens near bottom

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

  • Yes, I've updated all my dependencies.
@tstanescu1 tstanescu1 added 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 labels Apr 1, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Tiptap: Issues Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant