Open r1cep opened 2 weeks ago
It appears Chrome is reporting a different selection (via getSelection
) than it is actually displaying. We've had some issues like that before (see also #41467501, which still hasn't really gotten taken seriously on the Chrome side). What I am seeing is that the cursor is moved to the proper place after you confirm the composition with Enter. As such, does this impact actual editing, or is it just producing a visual discrepancy with the cursor being drawn in the wrong spot?
As such, does this impact actual editing, or is it just producing a visual discrepancy with the cursor being drawn in the wrong spot?
Yes, there are cases that affect the actual editing.
https://github.com/user-attachments/assets/3bdb8b9b-7d4f-442d-8297-ea820530edaa
The video above is an example.
Bug Description
When using IME to input Japanese characters with the ProseMirror editor's marks stored, the cursor is positioned to the left of the input character.
Steps to Reproduce.
https://github.com/user-attachments/assets/b8651960-201b-46ba-bf63-c5594b80a2fc
Browser Used
Chrome
Expected Behavior
The cursor is positioned to the right of the character you type.
Additional Context (Optional)
I've print debugged the issue at hand, and it seems that the result of the relevant Document.getSelection method is different between Chrome and Firefox.
https://github.com/ProseMirror/prosemirror-view/blob/5c33b883d39d7d40097e1fcdf17f543d18ad502a/src/index.ts#L498-L501
Table of results of executing the relevant Document.getSelection including bold in storedMarks
https://github.com/ProseMirror/prosemirror-view/blob/5c33b883d39d7d40097e1fcdf17f543d18ad502a/src/domchange.ts#L15-L25
Modifying the above parseBetween function as follows will solve this issue, but I am not sure if this is the right way to do it.