[lexical-react] Bug Fix: Add visibility margin to isTriggerVisibleInNearestScrollContainer to prevent popover from wrongfully closing#7844
Conversation
…tScrollContainer` inside `LexicalMenu`
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hi @dwrth! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
isTriggerVisibleInNearestScrollContainerisTriggerVisibleInNearestScrollContainer to prevent popover from wrongfully closing
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
etrepum
left a comment
There was a problem hiding this comment.
I like how simple this workaround is!
Description
Whenever the editors total height is so small that the LexicalMenu's popover is outside the bounds of it's parent element, the
isTriggerVisibleInNearestScrollContainerresults infalsewhenever theuseEffectinsideuseDynamicPositioningis run. This happens on scrolling and also navigating all the way to the bottom via the arrow keys.This PR proposes the addition of a margin to the visibility check in order for the popover trigger to still be considered "visible" even if it's slightly out of bounds.
Closes #7837
Test plan
Before
Screen.Recording.2025-09-22.at.09.54.58.mov
After
Screen.Recording.2025-09-22.at.09.55.39.mov