-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bug: Can't click on 1 character text links inside the paragraph #7551
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
Comments
In this case the RangeSelection normalizes to the closest TextNode which is always going to be one of the siblings of the LinkNode. If it were to behave like three adjacent TextNodes then the selection should land inside the link when it is at the end. You could probably work around this with a The ultimate problem here is that boundaries of TextNode and ElementNode always have multiple selection coordinates that are all visually equivalent and have "zero distance" between them, so heuristics have to be used to determine which one makes the most sense in any given situation. |
Internally the relevant code would be resolveSelectionPointOnBoundary in LexicalSelection.ts |
The selection system previously normalized to the closest TextNode sibling when dealing with link nodes, making one-character links difficult to select. This change modifies resolveSelectionPointOnBoundary to: - Keep selection inside link nodes instead of normalizing to siblings - Handle one-character links specially by maintaining internal selection - Preserve existing behavior for other inline elements Fixes facebook#7551
…node This change modifies resolveSelectionPointOnBoundary to: - Handle all inline elements consistently based on structure rather than type - Keep selection inside single-text-node inline elements - Remove type-specific checks in favor of structural checks - Maintain existing behavior for multi-child inline elements Fixes facebook#7551 Co-authored-by: Bob Ippolito <bob@redivi.com>
CleanShot.2025-05-20.at.16.11.16.mp4
The issue occurs with the one character links inside the paragraph, standalone one character link works great, also if you select the single character it works.
I'm assuming it has something to do with node selection, as you can see in the tree view, it selects the previous and next node for this edge case instead of selecting the child text inside the link node.
https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/FloatingLinkEditorPlugin/index.tsx#L342
Lexical version: 0.31.2
Steps To Reproduce
The expected behavior
I should be able to somehow select the one character link and open the associated toolbar.
Impact of fix
Let me know if there are any suggested workarounds for this.
The text was updated successfully, but these errors were encountered: