[lexical-playground] Bug Fix: Show floating link editor for single-character links#8392
Merged
etrepum merged 1 commit intofacebook:mainfrom Apr 26, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Apr 26, 2026
Collaborator
etrepum
left a comment
There was a problem hiding this comment.
Would it clean things up in here if there was a getSelectedLinkNode helper function that did all of the checks (selection of link directly, parent is a link, right-biased sibling of text is a link) and returned the best candidate?
…aracter links Apply right bias for collapsed selections at text node boundaries so the floating link editor appears when the cursor is adjacent to a LinkNode. Previously, single-character links never showed the popup because the cursor always landed on the boundary where the browser reports it as outside the link. Fixes facebook#8184
e3c2632 to
66f6ef1
Compare
Contributor
Author
|
That's much cleaner. refactored into a single $getSelectedLinkNode helper that handles all three cases. Force-pushed. Thanks! |
etrepum
approved these changes
Apr 26, 2026
mayrang
commented
Apr 27, 2026
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #8184
When a link contains only one character, the floating link editor popup never appeared when navigating with arrow keys. The cursor always lands on a node boundary where the browser reports it as outside the link.
Added a
$getAdjacentLinkNodehelper that applies right bias for collapsed selections, as suggested by @etrepum in #8184: when the cursor is at the end of a TextNode and the next sibling is a LinkNode, treat it as being on the link. Applied in$updateToolbar,$updateLinkEditor(URL), and$updateLinkEditor(position).Test Plan