[lexical-playground] Bug Fix: Prevent floating link editor from overflowing bottom of editor bounds#8387
Conversation
…lowing bottom of editor bounds Add bottom boundary check to setFloatingElemPositionForLinkEditor so the popup flips above the link when it would otherwise overflow the editor scroller's bottom edge. Fixes facebook#8362
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
left a comment
There was a problem hiding this comment.
It looks like this does it based on editor bounds but not also screen bounds so it might be worth fixing that too, or maybe just refactoring the link editor to use @floating-ui/react if it doesn't already.
mayrang
left a comment
There was a problem hiding this comment.
Thanks for the review! I think manually patching each edge case isn't sustainable. I'd prefer refactoring to @floating-ui/react if that direction works for you — or would you rather I just add a viewport bounds check on top of this for now?
|
Refactoring for |
|
I'll open a new PR that refactors the link editor to use |
Description
Fixes #8362
When a link is near the bottom of the editor, the floating link editor popup overflows the editor scroller's bottom edge and gets clipped. This happens because
setFloatingElemPositionForLinkEditorchecks for top and right boundary collisions but not bottom.This adds a bottom boundary check that mirrors the existing top boundary check — when the popup would overflow the bottom edge, it flips above the link instead:
Test Plan