Skip to content

Sometimes moving the caret does not work #146

@vitmf

Description

@vitmf

Describe the bug
Sometimes, after moving the caret when another user is editing the document, the caret returns to the previous spot.
I think the following is happenning:
After changing selection, prosemirror updates its state after receiving the event selectionchange. Also, after updating the document, y-prosemirror restores the saved caret position. However, if the user is moving the caret (by clicking, for example) and another user is editing the document, we may have the mousedown event, then y-prosemirror updates the prosemirror document and restores selection, and only then the selectionchange related to the click is dispatched. However, the original caret change has been overridden by y-prosemirror.

To Reproduce

  • Create a document with some text;
  • One user continuously edit the document(by adding a letter, for example);
  • The other user clicks in different positions in the document. Sometimes, the cursor will not be placed in the clicked place.

Expected behavior
The caret should always stay in the clicked place.

Environment Information
Chrome 116.0.5845.110
Firefox 116.0.3
yjs 13.5.52
y-websocket 1.5.0
y-prosemirror 1.2.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions