Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor jumps back to end of previous line in Firefox #3663

Closed
leaf-node opened this issue Nov 9, 2019 · 19 comments
Closed

Cursor jumps back to end of previous line in Firefox #3663

leaf-node opened this issue Nov 9, 2019 · 19 comments

Comments

@leaf-node
Copy link

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. : )

@leaf-node
Copy link
Author

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

@sebw
Copy link

sebw commented Mar 18, 2020

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.

@muxator
Copy link
Contributor

muxator commented Mar 18, 2020

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

@quenenni
Copy link

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?

@xens
Copy link

xens commented Mar 18, 2020

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.

@leaf-node
Copy link
Author

#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.

@quenenni
Copy link

I tested Etherpad at this commit: 467fc11

And in FF (new profil), no problem.
Came back to last commit (8261229), new FF profil, the problems occurred.

@muxator
Copy link
Contributor

muxator commented Mar 18, 2020

Confirmed on the development branch (currently 8261229) 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:

    if ((prevSib = n.previousSibling))

  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:

@xens
Copy link

xens commented Mar 18, 2020

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.

@muxator
Copy link
Contributor

muxator commented Mar 18, 2020

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.

@muxator
Copy link
Contributor

muxator commented Mar 18, 2020

@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.

@rottaran
Copy link

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

@muxator
Copy link
Contributor

muxator commented Mar 19, 2020

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.

@leaf-node
Copy link
Author

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

@muxator
Copy link
Contributor

muxator commented Mar 19, 2020

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 840b4a0, clean installation without plugins
  • Firefox 74.0, clean cache

@muxator
Copy link
Contributor

muxator commented Mar 23, 2020

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

Thanks.

@muxator muxator closed this as completed Mar 23, 2020
@leaf-node
Copy link
Author

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! : )

@leaf-node
Copy link
Author

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

@JohnMcLear
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants