Clicking at end of line in RTL text places cursor at wrong location in Chrome

You can repro on the bidi example page in Chrome: CodeMirror Right-to-Left Text Example

Click at the end of the line (on the left) and the cursor will be placed on the right-side of the first character rather than the left.

It does not happen in Firefox.

I believe its related to this commit: https://github.com/codemirror/view/commit/9ad612ac32a3e44b831999061d7bcbeec063df5d

This patch seems to solve this.

It seems to be fixed, but only for un-marked text. If you have a mark for the text this breaks again:

Right. On closer look, it seems like there’s some rather fundamental assumptions in the code that locates the position closest to a set of coordinates that don’t hold up in bidirectional text. This will take some more time to fix. Putting it on my to-do list.

1 Like

I have a fix for this in the block-wrapper branch (see this thread). It will be released properly when that code has had a bit more time to prove itself, but is already available as @codemirror/view 5.39.0-beta.3

1 Like