facebook / facebook/lexical

Bug: Collapsed selections expand to nearest HTML tags on link insertion

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

Description

Lexical version: v0.12.4

## Steps to reproduce

1. Go to https://playground.lexical.dev/.
2. Click (not select) on the word ‘typing’ (you should see the text cursor blinking, a.k.a. a collapsed selection).
3. Click on the ‘Insert link’ button.

## The current behavior

The collapsed selection expands to the nearest HTML tags:

> . Try typing in

## The expected behavior

The collapsed selection should only expand to the current word:

> typing

or (another solution) nothing should happen at all for collapsed selections.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the Lexical playground using version v0.12.4 and the Insert link button. Trace the link-insertion handling for a collapsed selection and determine where it expands to surrounding HTML tags. Done means the selection stays on the current word or remains unchanged instead of expanding to nearby tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.