antonmedv / codejar

An embeddable code editor for the browser 🍯
https://medv.io/codejar/
MIT License
1.8k stars 116 forks source link

Cursor jumps to end of editor when deleting certain text nodes in Firefox #111

Open dosisod opened 11 months ago

dosisod commented 11 months ago

Steps to reproduce

import {CodeJar} from │'codejar';
                      ^

The space character gets deleted, but the cursor also jumps to the end of the div/editor. This isn't happening in Brave/Chromium, so I suspect it is a Firefox specific issue.

From what I can tell this happens when a whitespace text node gets deleted, but only if it's between 2 non-text elements. This isn't an issue when deleting non-text elements like <span>, or deleting whitespace characters in the middle of multiple whitespace characters in a text node.

eric-hemasystems commented 10 months ago

I'm also getting this issue (in Firefox as well). I updated the editor not too long ago. Prior to that it didn't do that so it was a problem introduced (which means maybe a git bisect could find the culprit).