Error when selecting and deleting with decoration in Firefox

Hi there! We’re running into an error coming from within prosemirror’s domobserver.js. It’s easiest to see this in the demo (vs. me trying to explain it in words), so I’ll provide the reproduction steps along with the glitch link. Note: this error does not occur in Chrome.

Glitch :・゚✧

Reproduction Steps

  1. Select from the start of the document to anywhere in the document
  2. Type a letter
  3. Observe the error in the console (should say something like i is null)

Potentially relevant notes

  • The NodeViews are nested. That is, the schema has the paragraph node as a child of the monologue node, and both of the node types have NodeViews defined. There may be something we’re missing here in terms of what the right way to go about this is.
  • The issue also seems to require that there be a decoration at the start.

Thanks in advance for the help!

This patch should help with this.

1 Like

Awesome, thanks for fixing this!

Hi again,

I’ve found another error that happens in a similar situation except it occurs when there is another decoration and the selection ends outside of it. I’ve modified the same glitch link to exhibit the behavior.

  1. Select from the beginning of the text to anywhere past the end of the blue decoration.
  2. Type a character
  3. Observe an error in the console saying Uncaught RangeError: Position -1 out of range

Again, this only happens in Firefox.

You have some very dodgy ignoreMutation methods in that code, which will cause ProseMirror to ignore content-relevant mutations, which will indeed break stuff. I couldn’t figure out why those methods are there, but they look like you should just remove them.

Ah gotcha, thanks for pointing that out. We had a particular case we were trying to handle by ignoring most mutations, but it seems this was not the best way to go about it.