lexical
lexical copied to clipboard
Bug: Context Menu sometimes is not aligned and moves when the content is scrolled
Lexical version: 0.18.0
Steps To Reproduce
- In the Playground, make the content longer than the current screen height.
- Turn on the
Use Lexical Context Menufrom theSettings - Highlight something and then
Right Clickto show the Context Menu. - Scroll.
- Highlight something else again and then
Right Click. The Context Menu is now in a different location. - (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.
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.
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.
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.
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.