Skip to content

Bug: [lexical-table] A node inserted while a ragged table selection ends on a row with only a hole is lost #9756

Open

Description

@zurfyx

Summary

With #9749, a table selection whose last row has only a hole and cells spanning from above within the selection (a ragged table) returns that row's TableRowNode as the last node of getNodes(). $insertNodeToNearestRoot (@lexical/utils) starts from the last selected node, so a node inserted while such a selection is active (an image, a horizontal rule) never reaches the document. Before #9749 the same selection threw in getNodes(), so the insert was lost there too, with an error.

Reproduction

Rows ['OUT', A (rowSpan 2), 'B'] and ['OUT2'] (a ragged table, as concurrent row and column inserts leave it, the table transform not run); a table selection from A to B; then $insertNodeToNearestRoot($createHorizontalRuleNode()) (or any block insert that uses it): the node is not in the editor state afterwards.

Direction

Either $insertNodeToNearestRoot should take the focus cell (or the last cell) of a table selection rather than its last node, or getNodes() should not end on a row node. The trailing row is kept on purpose: a copy of the selection needs it, so that a pasted row span is not cut short.

Activity

  1. added 2 commits that reference this issue on Nov 6, 2026
    efc759e
    dc643a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions