Skip to content

Comments

[6.x] Fix Firefox not receiving text selection in nested Bards#14021

Open
jaygeorge wants to merge 2 commits into6.xfrom
fix-clicking-a-nested-bard-in-firefox
Open

[6.x] Fix Firefox not receiving text selection in nested Bards#14021
jaygeorge wants to merge 2 commits into6.xfrom
fix-clicking-a-nested-bard-in-firefox

Conversation

@jaygeorge
Copy link
Contributor

@jaygeorge jaygeorge commented Feb 20, 2026

Description of the Problem

As per #13852, In Firefox, clicking inside a Bard field that is nested within another Bard field (e.g. Bard > Replicator > Bard) doesn't work properly. You cannot single-click to place the cursor or double-click to select a word. Triple-clicking to select a paragraph does work.

This is caused by Firefox bug 739071 (opened 13 years ago, WOW) — text selection doesn't work inside elements that have an ancestor with draggable=true. ProseMirror sets draggable=true on the Bard Set's node-view-wrapper element during initialization because the Set node spec has draggable: true. The existing workaround in the updated() hook resets this to false, but only on Vue re-renders — ProseMirror can set it back at any time in between.

What this PR Does

  • Fixes Cursor and text selection not working in nested Bard fields in Firefox #13852
  • Adds a MutationObserver in the Bard Set component's mounted() hook that watches the draggable attribute on the node-view-wrapper and immediately resets it to false whenever ProseMirror changes it. This ensures draggable never stays true long enough for Firefox's bug to prevent text selection in nested editors.

How to Reproduce

  1. Add text in a nested Bard field and try to highlight something in Firefox

…able ancestor

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines 346 to 348
updated() {
// This is a workaround to avoid Firefox's inability to select inputs/textareas when the
// parent element is set to draggable: https://bugzilla.mozilla.org/show_bug.cgi?id=739071
this.$el.setAttribute('draggable', false);
},
Copy link
Member

Choose a reason for hiding this comment

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

I think the setAttribute in updated is redundant now?

The old code was a Firefox workaround that cleared draggable on the root so inputs inside the node could be focused. If the editor (e.g. TipTap) now only makes the element with data-drag-handle draggable and no longer marks the root as draggable, that workaround is redundant.
@jaygeorge
Copy link
Contributor Author

Ah yes, Claude seems to think it's OK to remove that too. I re-tested the fix in Firefox and it still works fine.

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.

Cursor and text selection not working in nested Bard fields in Firefox

2 participants