Skip to content

Bug: DELETE_LINE_COMMAND on an empty ListItem removes the previous decorator #8722

Description

@levensta

Lexical version: 0.45

Steps To Reproduce

  1. Insert the decorator node
  2. Insert a list with an empty first listitem
  3. Place the cursor on the first listitem and press Ctrl + Backspace

Link to code example: https://playground.lexical.dev/#doc=H4sIAAAAAAAAE9VWzW7bMAx-FYKXXbw4aTMs9XXFuj8MKzJgA4YdGImxtciSIVFJjaKXvcVOe8U9wmAHSdt06IAsKNaTQdL--JH8JPoSWRvxYSokjMUlBu-le6rKWB3YYfHlEqVtGAtsfZI0Y8xwySEa77AYZTj3oSbBAju_0exfn2KB-nw1Xp18Kj-rc7zKdvBuGF8z1Cawkh7OJWtvIxqn2QkWw2zDwpooRrjeobEkmxiL0Z1kmoWM7RE2wMMMa687MNd5LGYYpbW8Til80SV_UbFagE8CUjEorxm8A58C4JZL_-pNHgfLfmbkVZpB4MbHbkDtfUn3aaJb7DQwsN18KxRKlq1lpCO3NlKwWGAl0sQiz0sjVZoNlK_zOSmeeb_ILV8YRbaf-r7VDw5d7X2SOTrY0D5Yasvgk9NrvShyMGOY956HUE3FgR-bUHIJzHlNxuUNqQWVHDehp822oY9HTscHm-Ybbx7uwjk1UfmgYcphyeG_FJFeU-xVZNzSCOdv67Px6ty505N_EghQd2QrElgZqfoLX5jqB9XNeE_EHbTO9XEdnSVrWfqCKUgfFSqxwGTv7uR9W_eOotg2gxU_Cd2adFHIiW2BtDauBOW9BccrmDNJChxBPEhlIlwf7gFMPdS0YIgpMLQ-geq374zUArpLDVYVuz7g-EKgZAHqBuYU_-103FuY-AW7P9b16-eP79fIXPtvZqfTylKM76nexqGipmljbSz_T9dVQ4HKQE21w7_DfnnNqzOnGy57pOn_HG9RvcrQUpQpLVljMXo-GU2Oh5PhZHx0nGH0KSi-tTRvfo3DwfjZYIhXvwHxyqQ9ogoAAA

The current behavior

The DecoratorNode before the first ListItem is removed but the ListItem itself being empty remains. The listitem is correctly removed if it is preceded by a regular element rather than a decorator

Screen.Recording.2026-06-19.at.04.04.49.mov

The expected behavior

The ListItem is removed, but the decorator remains

Impact of fix

This is unexpected behavior since DELETE_LINE_COMMAND is expected to apply only to the current line when the decorator is on the previous line

There is another problem with DELETE_LINE_COMMAND when there is text in the ListItem, the command first deletes the text itself and only the second time deletes the item

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions