I have a simple widget created using the following code:
let deco = Decoration.replace({
widget: new CheckWidget(checked),
inclusive: true,
});
The blinking cursor’s position is after the widget in Chrome, which is expected; however, it is before the widget in Safari, which seems to be incorrect:
Chrome:
Safari:
Could you review this and check if this is a bug? Thanks a lot!
Are you using @codemirror/view 0.18.14? That fixes a bug that may be related to this. If that doesn’t help, is the cursor just drawn incorrectly, or is it also incorrect in state.selection?
I upgraded to 0.18.14 but the issue still exists. I think it’s just the currsor is drawn incorrectly in Safari. The selection is correct. I made a screen recording:
Hey, thanks for setting up a github repository, but there’s still a lot of code in there. What I was talking about was a simple script that just creates a widget in a vanilla editor, so that I don’t have to deal with a lot of peripheral complexity to figure out what is causing this. I can’t reproduce the issue when I just add an <input type=checkbox> with side = -1 as a widget.
Ah, you are using the native selection. That does indeed produce a very weird cursor on Safari in this situation.The only workaround I could find for that is to wrap the widget in a span and put zero-width spaces on both sides of the checkbox. Setting the selection differently from the library side doesn’t appear to be able to affect this. Any reason you’re not using drawSelection?