Skip to content

[lexical] Fix: Delete emptyable inline ElementNode in selection#8204

Open
levensta wants to merge 3 commits intofacebook:mainfrom
levensta:main
Open

[lexical] Fix: Delete emptyable inline ElementNode in selection#8204
levensta wants to merge 3 commits intofacebook:mainfrom
levensta:main

Conversation

@levensta
Copy link
Contributor

@levensta levensta commented Mar 10, 2026

Description

Users can create custom nodes that combine two methods: canBeEmpty and isInline, which returns true. The current fix ensures that it will be deleted via the RangeSelection.deleteCharacter method

Closes #8205

Test plan

Before

There is no example of a node in the lexical-playground that simultaneously returns true for both methods: canBeEmpty and isInline

After

Added unit test with a synthetic example

@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 Mar 10, 2026
@vercel
Copy link

vercel bot commented Mar 10, 2026

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Mar 10, 2026 6:46pm
lexical-playground Ready Ready Preview, Comment Mar 10, 2026 6:46pm

Request Review

@levensta levensta changed the title [lexical] Fix: Delete emptyable and inline ElementNode in selection [lexical] Fix: Delete emptyable inline ElementNode in selection Mar 10, 2026
@etrepum
Copy link
Collaborator

etrepum commented Mar 10, 2026

I think it would be valuable here to add an actual use case to the playground so that it can be confirmed that this type of inline canBeEmpty ElementNode behaves well in real situations, since this also creates interactions with selections and other kinds of nodes

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Mar 10, 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.

Bug: Empty inline ElementNode is not deleted inside an other ElementNode

2 participants