payload icon indicating copy to clipboard operation
payload copied to clipboard

Issues selecting lexical rich text in drawer

Open wkentdag opened this issue 1 year ago • 0 comments

Link to reproduction

No response

Describe the Bug

When a lexical rich text editor is rendered within a drawer, you can't click and drag your mouse to select text. If you double click and drag your mouse, it breaks the existing selection instead of extending it. This is unique to Lexical rich text fields in a drawer (ie not an issue for plain text fields in a drawer, or lexical fields in the regular non-drawer editor).

You can still use shift+arrows to alter the selection, so IMO it's a minor issue. But I have had several non-technical content editors complain about not being able to select text in the editor, so figured I'd log the bug and see if there's an easy fix to be had. I'm guessing that there's some interference between the mouse event listeners on the drawer and within the lexical rich text field... happy to submit a PR if anybody can point me in the right direction 🙂

https://github.com/user-attachments/assets/16050561-2f66-45e9-9f30-b6b30ba28528

nb: in the video at 0:15 I switch to a new tab that has the drawer document open in the main editor, and demo how the text selection works as expected there.

To Reproduce

  1. In the Payload admin demo, open one of the demo posts
  2. Under Hero > Links > Related Posts, hit the "edit" icon to open a different post in a drawer
  3. Under Content > 01, click twice, without releasing the second click, drag the mouse
  4. Note that the current text selection is broken
  5. Open the same document in a new tab (no drawer)
  6. Repeat step 4, note that the current text selection extends along with your cursor until you release

Payload Version

2.23.1

Adapters and Plugins

No response

wkentdag avatar Aug 08 '24 00:08 wkentdag