Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes moving the caret does not work #146

Open
vitmf opened this issue Oct 14, 2023 · 0 comments
Open

Sometimes moving the caret does not work #146

vitmf opened this issue Oct 14, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@vitmf
Copy link

vitmf commented Oct 14, 2023

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

@vitmf vitmf added the bug Something isn't working label Oct 14, 2023
@vitmf vitmf changed the title Moving caret sometimes does not work Sometimes moving the caret does not work Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants