facebook / facebook/lexical

Bug: Deleting first list item with nested list items and no siblings of same depth results in a strange cursor position

Open
#4,525 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

When deleting a list item that has no next sibling of the same depth, the selection ends up in a weird state

Lexical version: 0.9.1 (looks to occur on current lexical playground too)

## Steps To Reproduce

Start with a list item like the following:
- ABC
- XYZ

Delete the ABC text and then hit backspace one more time to delete the topmost list item
![image](https://github.com/facebook/lexical/assets/20935540/3f5a9823-8aaf-4fe1-a497-25ecc318006a)

Cursor is now in a weird state
![image](https://github.com/facebook/lexical/assets/20935540/3525414b-a25f-490d-a06f-7a60bb0536ef)

## The expected behavior
I would expect the cursor to be at the top left of the editor

Contributor guide

Open the contributing guide

Research direction

Reproduce the nested-list deletion sequence in the current Lexical playground, starting with a top-level item containing only a nested item. Trace the list deletion and selection handling; the fix is complete when deleting the top-level item leaves the cursor at the editor's top-left position.

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.