-
Couldn't load subscription status.
- Fork 2k
[lexical-react] Bug Fix: LexicalMenu guard against undefined option when list shrinks #7899
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
[lexical-react] Bug Fix: LexicalMenu guard against undefined option when list shrinks #7899
Conversation
|
Hi @MRADULTRIPATHI! 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 [email protected]. Thanks! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
I have signed the CLA ✅ |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Co-authored-by: Bob Ippolito <[email protected]>
Co-authored-by: Bob Ippolito <[email protected]>
|
Thanks again @etrepum |
Title
[lexical-react] Bug Fix: guard against undefined option when list shrinks
PR Types:
Bug Fix
Description
When navigating the typeahead menu with ArrowDown/ArrowUp, if the list shrinks (e.g. type
@p, move down to last option, then continue typing@poo),options[newSelectedIndex]can becomeundefined.This causes a crash:
Added a guard for missing option before accessing
.ref, and safely reset the highlighted index when the list shrinks.This prevents crashes and ensures stable keyboard navigation in the typeahead menu.
Closes #7897
Test plan
Before
Steps:
@pto open mention listpoo) so that the list shrinks❌ Crash occurs in console:
After
Steps:
@pto open mention listpoo) so that the list shrinks✅ No crash, console stays clean, and list resets correctly.
Screenshot: