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

Page scrolls down after document load on Firefox #385

Open
Bilal-io opened this issue Aug 30, 2017 · 12 comments
Open

Page scrolls down after document load on Firefox #385

Bilal-io opened this issue Aug 30, 2017 · 12 comments

Comments

@Bilal-io
Copy link

This issue only happens on FF.
I rolled back to using wysihtml5 by xing for now which I didn't have the issue with.

Tested on:
MacOS 10.12.6
FF 55.0.x

@skurfuerst
Copy link

Confirmed, having the same issue here!

@padosuperstar
Copy link

Same problem here please resolve!

@tomkowalski
Copy link

I have the same issue. Does anyone have a workaround they have found (besides changing to a different project)?

@Stryker93
Copy link

Stryker93 commented Oct 18, 2017

Having the same problem with the current firefox.

My dirty workaround (because I did not found where wysihtml scrolls down to the page bottom):
Just added
setTimeout(function (){ $(window).scrollTop(0); }, 100);
at the bottom of wysihtml.js

@rjvandoesburg
Copy link

@Stryker93 Only downside of that is when you are scrolling down ASAP and once that is triggered you are back at the top of the page again.

I tried something similar and ended up removing the scroll to action because it also caused unwanted behavior.

Might swap to Quill if this issue sticks around 👎

@Nyholm
Copy link
Contributor

Nyholm commented Nov 2, 2017

This issue does not exist in Firefox 54.

@Bilal-io
Copy link
Author

Bilal-io commented Nov 6, 2017

@Nyholm true, when I used this, I hadn't noticed the error until a team member told me about it. After some testing, It turned out to be the new versions of FF only.

So the question, was there something FF deprecated? Or perhaps added that caused it?

@skachhwalverma
Copy link

What could be the reason for this behavior? What hotfix do you suggest?

@tcjr
Copy link

tcjr commented Feb 22, 2018

Still seeing this. Does anyone have a workaround?

@skachhwalverma
Copy link

skachhwalverma commented Feb 22, 2018

I added this js script after all the js scripts included in the application :


if (typeof window != 'undefined' || !window){
    window.onload = function() {
        if(typeof navigator != 'undefined' || !navigator){
          var usrAgent = navigator.userAgent;
            console.log(usrAgent);
            if(usrAgent.toLowerCase().indexOf('firefox') > -1){
              var match = usrAgent.match(/Firefox\/([0-9]+)\./);
              if (match && parseInt(match[1]) > 54){
                window.scrollTo(0, 0);
              }
            }
        }
    }
}

@francis
Copy link

francis commented Mar 1, 2018

Doesn't that scroll to the top of the page? We are using version 0.5.5, and I've tracked down the two places that are causing this. The two places are:

  1. the top method in polyfills.js (this could be more specific about Quantum, but since this is a workaround for 'Safary'...)
   // Safary has a bug of not restoring selection after node.normalize correctly.
   // Detects the misbegaviour and patches it
   var normalizeHasCaretError = function() {
+     // in the new Firefox Quantum, the code below causes the page to jump/scroll. Therefore, just return false.
+    if (window.navigator.userAgent.indexOf('Firefox/') > -1) {
+        return false;
+    }
     if ("createRange" in document && "getSelection" in window) {
  1. We have a workaround loading of TextRange module can cause scrolling on mobile devices timdown/rangy#292 that also was causing scrolling issues, and we had to tweak it too. See that ticket for more info.

@rjvandoesburg
Copy link

@francis Took me a while to find the bugger, only had minified version. Added the change and it stopped scrolling FF :)

Cheers for the fix 👍

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

No branches or pull requests

10 participants