Weird behavior with e2e test when clicking on a custom node

I have a custom node I’ve created that needs to go at the beginning of paragraphs as a category. It looks like this:

export const categoryNode: NodeSpec = {
  inline: true,
  group: 'inline',
  toDOM() {
    return [
      'category',
      {
        class: 'category cursor-pointer',
      },
      ['span', { contenteditable: false }, '('],
      ['span', 0],
      ['span', { contenteditable: false }, ') '],
    ]
  },
  parseDOM: [
    {
      tag: 'category',
    },
  ],
}

We are using cypress to write some e2d tests. However, when I perform the following: cy.get('category') even without clicking on the node, the result is that the node is removed, and the text content of the node bubbles up to the paragraph:

This

    {
      "type": "paragraph",
      ...
      "content": [
        {
          "type": "category",
          "content": [
            {
              "type": "text",
              "text": "UNSET"
            }
          ]
        },
        {
          "type": "text",
          "text": "oh hai"
        }
      ]
    }

becomes this

    {
      "type": "paragraph",
      ...
      "content": [
        {
          "type": "text",
          "text": "UNSEThai"
        }
      ]
    },

Any idea what I’m doing wrong? I may try with Playwright to see if I get the same behavior.

Thanks in advance.