Skip to content

[lexical-react] Bug Fix: Add visibility margin to isTriggerVisibleInNearestScrollContainer to prevent popover from wrongfully closing#7844

Merged
etrepum merged 1 commit intofacebook:mainfrom
dwrth:fix/lexical-menu-closing-on-scroll
Sep 22, 2025
Merged

[lexical-react] Bug Fix: Add visibility margin to isTriggerVisibleInNearestScrollContainer to prevent popover from wrongfully closing#7844
etrepum merged 1 commit intofacebook:mainfrom
dwrth:fix/lexical-menu-closing-on-scroll

Conversation

@dwrth
Copy link
Copy Markdown
Contributor

@dwrth dwrth commented Sep 22, 2025

Description

Whenever the editors total height is so small that the LexicalMenu's popover is outside the bounds of it's parent element, the isTriggerVisibleInNearestScrollContainer results in false whenever the useEffect inside useDynamicPositioning is 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

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Sep 22, 2025 7:59am
lexical-playground Ready Ready Preview Comment Sep 22, 2025 7:59am

@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Sep 22, 2025

Hi @dwrth!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@dwrth dwrth changed the title [lexical-react] Bug Fix: Add visibility margin to isTriggerVisibleInNearestScrollContainer [lexical-react] Bug Fix: Add visibility margin to isTriggerVisibleInNearestScrollContainer to prevent popover from wrongfully closing Sep 22, 2025
@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Sep 22, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla 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 Sep 22, 2025
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Sep 22, 2025
Copy link
Copy Markdown
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 like how simple this workaround is!

@etrepum etrepum added this pull request to the merge queue Sep 22, 2025
Merged via the queue into facebook:main with commit 25d77f6 Sep 22, 2025
43 checks passed
This was referenced Sep 25, 2025
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. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: LexicalTypeaheadMenuPlugin closes when trying to scroll inside the dropdown list

2 participants