FloatingUI for LexicalMenu positioning #7409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Currently has a bug with the Paste event from the custom context menu, where it appens to the start of the editor, vs where the selection was done. I guess it's a focus-related thing. Yet to pin down. |
I have found a much cleaner approach to do this. I'll do the ContextMenu by itself not using the LexicalMenu component at all. So this would allow to clean up the LexicalMenu and get rid of the pointer vs caret coordinates derivation code in the useMenuAnchor hook and make easier to reason about menu positioning. |
8fc3af7
to
4966d37
Compare
Since the Core team agreed that it's OK for the @lexical/react package to depend on floating UI to fix the difficult problem of popovers positioning. This PR begins this transition. This PR does this for the typeahead-based menus.
This PR also introduces a breaking change, because it removes the custom
menuRenderFn
prop in LexicalMenu so one does not need to pass it in each typeahead widget (Mention, Forward slash, Emoji Picker, AutoEmbed), but reuses the same style and configuration for all them. This ensures consistency and reduces the overall codebase size and removes a bit of the duplicated code with respect to the playground code.There are other places where FloatingUI can be used like 'floating format toolbar', 'add comment popover', 'context menu', 'drag handle positioning', 'table hover action buttons', 'dropdown (toolbar and table action items)', 'the new + icon menu' those can come later on.