facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
17.61k stars 1.47k forks source link

Bug: pasting via Context menu (right-click menu) changes selection which creates all sorts of issues #6106

Open gigantedocil opened 2 weeks ago

gigantedocil commented 2 weeks ago

If you paste via the Context menu the selection underneath the menu changes and all sort of weird issues happen.

Lexical version: 0.15.0 (latest)

Steps To Reproduce

https://github.com/facebook/lexical/assets/18426489/d0dd535c-48fb-4ec1-9e56-c4f57369637c

Link to code example:

n/a

The current behavior

Pasting via the Context menu changes the selection underneath the menu creating all sorts of weird behaviours.

The expected behavior

Pasting via the Context menu should not change the selection underneath the menu.

ivailop7 commented 2 weeks ago

I can repro, need to pin down the commit when this got broken.

ivailop7 commented 2 weeks ago

@potatowagon any chance this is a byproduct of the ArtificalNode ?

gigantedocil commented 2 weeks ago

@ivailop7, not sure if this is helpful but this is also happening on v0.11.3 (did not confirm but it's likely that it was happening before that as well).

In addition to that, I forgot to mention that I reproduced this via the trackpad which involves pressing two fingers to achieve the right-click that brings up the context menu. I have a feeling that lexical interprets that as 2 clicks and that's what's making the selection change. It's possible that with a regular mouse that has a left and right button, pressing the right button won't have this behaviour.

ivailop7 commented 2 weeks ago

Thank you for the clarification. There should be no difference between ctrl-v and a context menu paste. Worth investigating for sure.