facebook / facebook/lexical

Bug: Incorrect range when adding comment over link

Open
#5,606 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 16h
Merged PRs (30d)
61

Description

Can be tested in Playground.
Wrapping selection in MarkNodes does not work correctly, if Link node is partially selected.

Lexical version: 0.13.1

## Steps To Reproduce

1. In Playground, create a comment before Link
![image](https://github.com/facebook/lexical/assets/50548714/fa3f518f-ad19-462a-9bcb-36a28091e966)
2. Comment part of Link node
![image](https://github.com/facebook/lexical/assets/50548714/fd147fe8-4bf5-4a7e-8f01-e23e8238d277)

Link to code example:
Can be reproduced in playground

## The current behavior
The whole link node gets wrapped in a comment:
![image](https://github.com/facebook/lexical/assets/50548714/80fc9593-2c45-4a2c-86ff-8bffc5374fda)

## The expected behavior
Only selected part gets wrapped in comment.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the Playground by creating a comment before a Link node and selecting only part of that link. Start by tracing the MarkNodes wrapping behavior for the partially selected Link. Done means the comment wraps only the selected part rather than the whole link node.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.