lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Bug: Context Menu sometimes is not aligned and moves when the content is scrolled

Open wenbert opened this issue 1 year ago • 3 comments

Lexical version: 0.18.0

Steps To Reproduce

  1. In the Playground, make the content longer than the current screen height.
  2. Turn on the Use Lexical Context Menu from the Settings
  3. Highlight something and then Right Click to show the Context Menu.
  4. Scroll.
  5. Highlight something else again and then Right Click. The Context Menu is now in a different location.
  6. (optional) With the context menu showing, scroll the page.

The current behavior

The Context Menu gets mis-aligned. It could be a couple lines down the current highlighted text. It also gets moved around when the user scrolls the page. screenshot_2024-10-04 23-30-11

The expected behavior

The Context Menu should be next to the highlighted content. It should stick and not move when the user scrolls the page.

wenbert avatar Oct 04 '24 10:10 wenbert

The code from the playground is not expected to be production-ready, and is not part of the Lexical library. It's only provided as examples for some functionality.

That being said, this does not qualify as a bug, but you are welcome to contribute with a PR for fixing the aforementioned behaviour, so that other users using the playground code can benefit from it.

moy2010 avatar Oct 04 '24 17:10 moy2010

I would say that the menu positioning is a bug, that we've been trying to fix but it's been tricky because Meta has (had?) some dependencies on the confusing/broken legacy behavior. Any improvements here would be appreciated. See also #6558, #6566, #6510, etc.

etrepum avatar Oct 04 '24 17:10 etrepum

I think maybe it's worth doing a clean slate context menu based on 'floating-ui.com', rather than try to fix this one for n-th time. For anyone interested, that would be my suggestion.

ivailop7 avatar Oct 05 '24 17:10 ivailop7