Bug: List: delete the leading ListItemNode will also delete the previous…
- User
Bug: List: delete the leading ListItemNode will also delete the previous DecoratorBlockNode Lexical version: 0.12.2
Steps To Reproduce
- Open the playground at https://playground.lexical.dev/
- Append a
DecoratorBlockNodeto the document, for example, aTweetNode - Insert a list after the
DecoratorBlockNode - Delete the first list item, and the previous
DecoratorBlockNodewill also be removed
https://github.com/facebook/lexical/assets/6022672/2ccbc2a0-af27-4d3f-a244-804f43249fec
The current behavior
Both the
ListNodeand the previousDecoratorBlockNodeare deleted.The expected behavior
Only
ListNodewould be deleted. (I will be more than happy to see theListNodebe replaced by aParagraphNodeif possible! That's the default behavior in other editors.)Interface
No new interfaces are introduced.
- Assistant
I’ll trace the list backspace/removal path, add a focused regression test around a preceding decorator block, then run the narrowest relevant test suite and type/lint checks as needed.
- Assistant
rgisn’t installed in this checkout, so I’m switching to targetedfind/grepsearches and keeping the investigation scoped to list behavior and its tests. - Assistant
The failure occurs before
ListItemNode.collapseAtStart()gets a chance to run: core backward deletion encounters the preceding block decorator and removes it immediately. I’m adding a regression that exercises the public deletion path, then I’ll adjust that decorator boundary so the current block’s collapse behavior can handle the backspace. - Assistant
The regression now passes: backspace converts the single-item list into a paragraph and leaves the decorator intact. I’m checking formatting/types and running the broader core/list unit coverage next, since the fix sits in shared selection deletion logic.
- Assistant
The broader selection/list unit suite passes (681 tests), and TypeScript is clean. ESLint found only import ordering in the new test; that’s corrected, and I’m doing the final lint/Flow verification now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.