Deletion of an inline node is not working if it is immediately followed by an inline atom node

Please have a look at gallant-sun-2kd4zq - CodeSandbox, which uses Tiptap.

On each line, go to the end of the line, then keep deleting.

  • Line 1: Characters are deleted one by one, which is correct
  • Line 2: “Ext2” (the atom node) is deleted in one go, other characters are deleted one by one, which is also correct.
  • Line 3: “Ext2” is still deleted in one go (correct), but “Ext1” is also deleted in one go (not correct).

I was directed from Tiptap to here because this is apparently a ProseMirror bug. Quoting a Tiptap contributor:

In cases like Ext1Ext2 where two nodes are directly adjacent, deleting Ext2 causes the editor’s selection to be placed after the Ext1 node. Pressing Backspace then removes the entire Ext1 node.

In contrast, when Ext1 is followed by any text node, deleting the text node places the editor’s selection at the end of Ext1node’s internal content. Pressing Backspace in this case deletes the text within Ext1.

I’m very sorry for not being able to present a reproduction not using Tiptap, as I only know how to use Tiptap… But the description of the behaviour should hopefully give you an overview of what the bug is about.

Ref: ueberdosis/tiptap#5920

Please provide a TipTap-free reproduction example, and I’ll take a look.