Skip to content

[lexical-link] Bug Fix: $toggleLink removes link when selection is collapsed#8138

Merged
etrepum merged 3 commits intofacebook:mainfrom
Senasiko:main
Feb 13, 2026
Merged

[lexical-link] Bug Fix: $toggleLink removes link when selection is collapsed#8138
etrepum merged 3 commits intofacebook:mainfrom
Senasiko:main

Conversation

@Senasiko
Copy link
Copy Markdown
Contributor

Description

This PR fixs an issue where, when the selection is collapsed, $toggleLink only affects the nearest TextNode

Before

before.mp4

After

after.mp4

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 12, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 13, 2026 5:58pm
lexical-playground Ready Ready Preview, Comment Feb 13, 2026 5:58pm

Request Review

Comment on lines +688 to +693
if (selection.isCollapsed()) {
parentLink.getChildren().forEach((child) => {
parentLink.insertBefore(child);
});
parentLink.remove();
} else {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would probably be better to handle this outside of the nodes.forEach loop

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change, please review again

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Feb 13, 2026
@etrepum etrepum added this pull request to the merge queue Feb 13, 2026
Merged via the queue into facebook:main with commit 48a3711 Feb 13, 2026
38 checks passed
@janpe
Copy link
Copy Markdown

janpe commented Feb 18, 2026

Any idea when this fix might be seen in a release?

@etrepum
Copy link
Copy Markdown
Collaborator

etrepum commented Feb 18, 2026

It’s already in the nightly release, the monthly release is another week or two out.

rayterion pushed a commit to rayterion/lexical that referenced this pull request Feb 18, 2026
…llapsed (facebook#8138)

Co-authored-by: Bob Ippolito <bob@redivi.com>
@etrepum etrepum mentioned this pull request Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants