Etherpad-lite: Cursor jumps back to end of previous line in Firefox

Created on 9 Nov 2019  路  19Comments  路  Source: ether/etherpad-lite

Thanks for Etherpad. It's a very cool project.

This issue is very similar to #3087. It appears in Firefox 68 on Debian Buster at https://beta.etherpad.org. This also happens with the latest version of FF and Trisquel 8, a fork of Ubuntu Xenial. I've noticed this issue with Firefox and Etherpad for a long time (maybe a year), and should have reported it earlier. I didn't bring it up since I thought it was a temporary bug with Etherpad's master branch. It does not appear in Chromium on Debian Buster.

When you write a long line of text (with or without spaces) that wraps to a new line, the weird behavior appears. Place your cursor at the beginning of a blank line under the wrapped line entered above. Then press the up arrow so it will go to the beginning of the wrapped part of the line (on the second line of the wrapped text). The cursor immediately jumps to the end of the previous line of wrapped text.

In addition, when the cursor has moved to the end of the previous line, pressing the down or right arrow once will move it to the beginning of the next line, then back to the end of the previous one.

The expected behavior is for the cursor to stay at the beginning of the line when seeking there.

This makes cursor navigation a bit tricky if you want to edit the lower lines of wrapped text. This is because you may be starting on a blank line below the wrapped text, so you would normally press the up arrow before you hit the right arrow to seek horizontally on the bottom, or a middle line. If you want to move the cursor from the top of the document to the bottom, you have to hold down the down arrow so it will make it past the wrapped line of text.

Thanks for working on Etherpad. : )

Bug UX editor

All 19 comments

I should note that the most obvious difference between this issue and #3087 is that the cursor jumps in the opposite direction.

Same problem on Fedora 31/Firefox 72.0.2.

I run Etherpad on Docker, I'm getting the issue on both latest and 1.8.0.

Deleted message: #3728 and this issue are not exactly the same, even if probably related.

Hello,

I had to install several instances of etherpad (last version, not on docker), but no-one can use the pads with this bug.

An idea on what version / commit doens't have that problem?

Same problem here docker container version 1.8.0 with both Chromium 80.0.3987.122 and Firefox 74, tried to downgrade to container version 1.7.5 but same issue.

3728 is a different issue, but may be related. This one only applies to text that wraps multiple lines, when the cursor seeks to the beginning of one of the wrapped lines.

I tested Etherpad at this commit: https://github.com/ether/etherpad-lite/commit/467fc11b723723275f1ebd0fed556a0525ea5f0b

And in FF (new profil), no problem.
Came back to last commit (https://github.com/ether/etherpad-lite/commit/826122932380e59c47ce963252cfe16bd46dbc0c), new FF profil, the problems occurred.

Confirmed on the development branch (currently 826122932380) on Both Firefox 74 and Chromium 80.

When the cursor jumps there are errors in the js console.

  1. Error in the JS console in Chromium 80 (not really useful):

    VM212:5 Uncaught TypeError: Cannot read property 'parentNode' of null
       at ae (eval at v (ciao:2), <anonymous>:5:13128)
       at Q (eval at v (ciao:2), <anonymous>:5:10395)
       at eval (eval at v (ciao:2), <anonymous>:6:15715)
       at d (eval at v (ciao:2), <anonymous>:5:2437)
       at f (eval at v (ciao:2), <anonymous>:5:2918)
       at eval (eval at v (ciao:2), <anonymous>:6:15656)
       at r (eval at v (ciao:2), <anonymous>:5:5987)
    
  2. Error number one in the JS console in Firefox 74:

    TypeError: n is nullciao line 24 > scriptElement line 9 > Function:2033:15
       getLineAndCharForPoint http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:2033
       incorporateUserChanges http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:1721
       idleWorkTimer http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:1213
       inCallStack http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:492
       inCallStackIfNecessary http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:561
       idleWorkTimer http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:1198
       callback http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:1149
    

    Which is at this point in this file: https://github.com/ether/etherpad-lite/blob/826122932380e59c47ce963252cfe16bd46dbc0c/src/static/js/ace2_inner.js#L2031

  3. Error number two in the JS console in Firefox 74:

Error: Failed assertion: mismatched composition of two changesets ciao line 24 > scriptElement line 9 > Function:5972:11
    error http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:5972
    assert http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:5986
    compose http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:7254
    _mergeChangesets http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:9274
    reportEvent http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:9308
    submitOldEvent http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:450
    inCallStack http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:520
    inCallStackIfNecessary http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:561
    idleWorkTimer http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:1198
    callback http://localhost:9001/p/ciao line 24 > scriptElement line 9 > Function:1149

Which comes from a catch-all error function here: https://github.com/ether/etherpad-lite/blob/826122932380e59c47ce963252cfe16bd46dbc0c/src/static/js/Changeset.js#L41

Same problem here docker container version 1.8.0 with both Chromium 80.0.3987.122 and Firefox 74, tried to downgrade to container version 1.7.5 but same issue.

Ok my bad it works well on 1.8.0 and 1.7.5. Clearing my browsers caches fixed the issue. So issue is only present on :latest.

I can confirm @quenenni's findings: reverting to 467fc11 fixes the problem for me too. If so, this is caused by having pulled in #3622.

I am going to prepare a PR which reverts those two commits. _Before_ merging that one, I would like the collaboration of everyone in testing it, so that we catch any remaining issues.

@everyone in this thread: could you please help and test #3729, reporting your findings?

If possible test on a clean instance and with empty browser cache.

I have a doubt, anyhow: the issue we are commenting on if from November 2019, and the changes that would revert were accepted recently (15th March 2020).

I would not be surprised to see some remaining problems.

3729 solved the issue for me after cleaning the browser cache.

Thanks @rottaran. My copy works well, too.

However, I am still puzzled by the fact that @sudoman reported this in November 2019: how can revert a later change fix his issue? There must be something else going on.

@muxator this issue was originally about something else. people started commenting on it regarding a different, but related issue.

Yep @sudoman, that's right. The other issue is now fixed, so we can go back to the issue you described here.

I am not being able to reproduce this problem. Do you still have it?

My setup:

  • Etherpad, current develop 840b4a098847, clean installation without plugins
  • Firefox 74.0, clean cache

Closing this, as it seems fixed.
Feel free to reopen it if the problem still persists.

Thanks.

I've discovered that this issue comes up even on Firefox 78 with a fresh dev instance of etherpad-lite. When you seek to the second line of text that wraps over more than one line, this bug doesn't appear at first. Once you press an arrow key to go up or down, this bug starts affecting that paragraph of text, and continues to affect that paragraph.

In the developer tools of Firefox, I noticed that the the text in the span element is expressed on one single line before the bug appears. Once you move the cursor a second time, the text splits onto multiple lines in the DOM. Chromium has this line splitting behavior too, but doesn't behave in a buggy way under this situation.

My guess is that this could be a Firefox bug. What do you think about that? Should we report upstream? Also, how difficult would it be to work around this by not splitting lines when moving the cursor? Thanks! : )

I should note that I was testing with version 1.8.4 of Etherpad Lite. Could you please re-open this issue? Thanks!

We have a separate issue open for the behaviour you are experiencing. Please refer to that

Was this page helpful?
0 / 5 - 0 ratings