facebook / lexical

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

Bug: Not able to set the text color upon closing color pallet #6520

Open aaaanilkumar opened 2 months ago

aaaanilkumar commented 2 months ago

The user can't set the text color if the color pallet is closed. On the other hand, it works fine if the pallet is not closed.

Lexical version: latest

Steps To Reproduce

  1. Go to the lexical playground and type a few characters
  2. Now select the text color from the top toolbar.
  3. Click inside the editor to close the pallet and type text further.
  4. Now you will see the text color is not applied.

Tab-1723604081401.webm

Link to code example: https://playground.lexical.dev/

The current behavior is text color is not applied.

The expected behavior should be text color applied.

2wheeh commented 1 month ago

It happens because selection is updated by clicking the text with black color when closing the dropdown:

https://github.com/user-attachments/assets/fae9abc2-afef-48fe-876f-feb1a43d2e28

2wheeh commented 1 month ago

So this can happen on other case as well such as font size. But in this case, it doesn't feel like a bug (at least for me). IMO, it is because there is no dropdown. So it is natural to continue writing without selecting the last text.

https://github.com/user-attachments/assets/e9140f2a-be89-4088-87de-16b0c381c681

2wheeh commented 1 month ago

So closing dropdown by click preserving the selection could be a fix.