In collab setup with selections, cursor jumps to a different position without selection being changed

I have set up a collab editor like in collab example on the website but with websockets. Its working fine.

I have now added the functionality where in all the users can see each others selections like in Google docs.


  1. Lets say two users are editing the same doc, user0 and user1.
  2. user0’s cursor is somewhere at the start of a line. And user1’s cursor is at the end of that line.
  3. Now, when user0 types a character, user0’s cursor jumps to the position of user1’s cursor. And then the characters are written at this new position.

You can see the sample here ->

The strange thing is when I try to look into “selection” in EditorState of the editor in chrome DevTools, the selection there shows the position at end of the line (where it should have been). Which means somehow DOM position changed but prosemirror’s position remained correct.

Please let me know, if it seems like a bug or something I am doing wrong. The code I have is all integrated with my application code. So it is hard to separate it out. But let me know, and I will try to figure out something.

Thanks and, BTW awesome editor :slight_smile:

Since this doesn’t happen in the collab demo on the website, it seems to be related to something you’re doing differently. I don’t have enough information to say what, though, and you’ll have to narrow it down before I can say whether it’s a bug in your code or in ProseMirror.

Ok. I will try to narrow it down then.

@abhinavzspace We have had caret sharing for a while in Fidus Writer and this doesn’t happen to us. Must be something about how you implemented it.

@johanneswilm Most likely I am doing something stupid. I just wanted to check. :slight_smile: I am tired trying to debug this issue, so I have kept it aside for a while. I will pick it up in a day or two, and try to isolate it into a separate standalone project, if it still occurs.

FWIW; We have the exact same issue. I’ll report back should I find the cause.

1 Like

@EtienneLem any luck?

We’re seeing some jumbling issues because of character rewriting with an inline span deco. If you haven’t already, you may want to look through how ViewTreeUpdater is dealing with your document and cursor inside NodeViewDesc.updateChildren.

We were having a similar problem. But, we found out it’s due to a Chrome bug reported here ->

It happens when you have a span near your cursor. But works without any problem in Firefox.

1 Like

Thanks. This worked so easily. Implemented it just now.

What did you implement to fix the issue?

Ah! So thanks to Cursor jumps from the line end to widget decorator I figured my Widget was just missing the key params.

Hello, I have this same issue, did anyone find a fix for this? I have no spans near to my cursor and have added a key to my widget as suggested, but it is still happening…thank you