Skip to content
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

RFC: FloatingUI for LexicalMenu positioning #6923

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ivailop7
Copy link
Collaborator

@ivailop7 ivailop7 commented Dec 9, 2024

To get rid of the popover menus positioning issues, floating-ui is the defacto standard for this problem, got it to work and works nicely. A few example to try:

Very long text now shows all the "/, @, :" menus correctly if the page is scrolled, also shows the menu correctly if typing on the last line in focus on the screen, it renders the menu upwards correctly. So this is technically the universal fix for 'popover' vs 'context menu'.

A few questions:

  1. Are we happy to have floating-ui/react as a dependency for lexical-react?
  2. Are we OK to remove the 'menuRenderFn' and unify the underer under LexicalMenu. So any plugin would just provide the menu items.

Clone and run locally to get a better idea of how it performs. Before I spend more time this, would like to gather some thoughts from the rest - @etrepum @zurfyx @fantactuka @potatowagon

Copy link

vercel bot commented Dec 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 1:35pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 1:35pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 9, 2024
Copy link

github-actions bot commented Dec 9, 2024

size-limit report 📦

Path Size
lexical - cjs 31.29 KB (0%)
lexical - esm 31.11 KB (0%)
@lexical/rich-text - cjs 40.34 KB (0%)
@lexical/rich-text - esm 33.04 KB (0%)
@lexical/plain-text - cjs 38.88 KB (0%)
@lexical/plain-text - esm 30.3 KB (0%)
@lexical/react - cjs 42.12 KB (0%)
@lexical/react - esm 34.29 KB (0%)

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 1000% for getting rid of Lexical's menu code and replacing it with something that works correctly without a large maintenance burden, floating-ui seems like the ideal choice. I also like floating-ui because it's not React dependent so when we start offering framework agnostic plugins it could work for that as well.

Our menu situation is a disaster, I don't think it works correctly for anyone but Meta (maybe?), and there aren't enough regression tests for anyone outside of Meta to fix it because any attempt to do so seems to end up getting reverted for reasons that are opaque to anyone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. popover Issues related to popover/menu code in the playground
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants