Voog / wysihtml

Open source rich text editor for the modern web

Home Page:http://wysihtml.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Page scrolls down after document load on Firefox

Bilal-io opened this issue · comments

commented

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

Confirmed, having the same issue here!

Same problem here please resolve!

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

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

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

This issue does not exist in Firefox 54.

commented

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

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

Still seeing this. Does anyone have a workaround?

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);
              }
            }
        }
    }
}

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 timdown/rangy#292 that also was causing scrolling issues, and we had to tweak it too. See that ticket for more info.

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