codejar icon indicating copy to clipboard operation
codejar copied to clipboard

Backspace forces cursor to end of text (Firefox)

Open nalgeon opened this issue 10 months ago • 1 comments

Repro steps

Using Firefox 124/125, visit https://medv.io/codejar/, focus in the editor and delete all the code.

Enter the following code:

const greet = (name) => {
    console.log(5);
}

greet("World");

Place the cursor after the 5 and hit the Backspace key on your keyboard.

Expected

Deletes 5 and cursor remains between parentheses.

Actual

Deletes 5 and cursor jumps to the end of the file.

Environment

Firefox 124/125, Windows/macOS.

Does not reproduce in Chrome or Safari.

nalgeon avatar Apr 21 '24 04:04 nalgeon

I don't yet have the solution but I might have a good starting point: In the save function, Firefox seems to "think" anchorNode, focusNode and editor are the same. In Chrome it works correctly and identifies them as different. image

The log In Chrome: image

The log in Firefox: image

GDur avatar Jun 13 '24 11:06 GDur