Bug: FloatingLinkEditor toolbar is clipped when a link is near the editor's bottom edge
Lexical version: latest (tested on https://playground.lexical.dev)
Steps To Reproduce
- Add content to the editor so the editor is scrollable.
- Place an image (or a multi-line link) near the bottom of the visible viewport.
- Click the image (or place the cursor in the link) to show the FloatingLinkEditor toolbar.
Link to code example: https://playground.lexical.dev
The current behavior
The toolbar is rendered below the link/image but extends below the visible viewport boundary, getting clipped. The toolbar should flip above the link in this case.
Reproduces in both Chrome and Safari.
The expected behavior
When the toolbar's default placement (bottom-start) would overflow the viewport, it should flip above the link.
Notes
The migration to @floating-ui/react in PR #8388 was intended to delegate viewport/scroller-aware clipping prevention to the library's flip and shift middleware. While this works for typical text-based RangeSelections, the NodeSelection case for image links — where the reference rect is the full image height — does not trigger flip as expected when the image is near the editor scroller's bottom edge. This case was not covered during the refactor and needs follow-up.
Initial debugging suggests the issue is more subtle than the boundary option alone (changing to 'clippingAncestors' or removing the boundary did not resolve it), and likely involves rootBoundary, the floating element's containing block under strategy: 'absolute', or portal mount timing.
Since this was missed during the floating-ui migration in #8388, I'll plan to follow up with a fix after #8419 is merged.