Open Bug 1922498 Opened 11 months ago Updated 21 days ago

ilgeniodellapizza.com - Scroll does not work correctly

Categories

(Web Compatibility :: Site Reports, defect, P2)

Firefox 133
Desktop
Windows 10

Tracking

(Webcompat Score:1, Webcompat Priority:P2, firefox131 affected, firefox133 affected)

ASSIGNED
Webcompat Score 1
Webcompat Priority P2
Tracking Status
firefox131 --- affected
firefox133 --- affected

People

(Reporter: ctanase, Assigned: twisniewski)

References

(Depends on 1 open bug, Regressed 1 open bug, )

Details

(Keywords: leave-open, webcompat:site-report, webcompat:sitepatch-applied, Whiteboard: [webcompat-source:product])

User Story

platform:windows,mac,linux,android
impact:site-broken
configuration:general
affects:all
branch:release
diagnosis-team:dom
user-impact-score:200

Attachments

(2 files)

Attached video scroll FF vs Chrome.mp4

Environment:
Operating system: Windows 11
Firefox version: Firefox 130.0.1 (release)/131/133

Preconditions:

  • Clean profile

Steps to reproduce:

  1. Navigate to: http://www.ilgeniodellapizza.com/le-nostre-pizze.html
  2. Scroll up and down the page.

Expected Behavior:
The page is scrolled without any issues.

Actual Behavior:
Keeps jumping when scrolling down and when scrolling up it scrolls automatically all the way to the bottom of the page.

Notes:

  • Reproducible on the latest Firefox Release and Nightly
  • Reproducible regardless of the ETP setting
  • Works as expected using Chrome

Created from webcompat-user-report:504699ee-dd61-48e5-bfe9-272000865664

Severity: -- → S2
User Story: (updated)
Priority: -- → P3
Webcompat Priority: --- → P2
Webcompat Score: --- → 6
Webcompat Score: 6 → 5

The page has this code:

    jQuery(document).ready(function() {
        function t() {
            var ua = navigator.userAgent, tem,
                M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
            if(/trident/i.test(M[1])){
                tem =  /\brv[ :]+(\d+)/g.exec(ua) || [];
                return 'IE '+(tem[1] || '');
            }
            if(M[1] === 'Chrome'){
                tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
                if(tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
            }
            M = M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
            if((tem = ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
            return M;
        }

        currentBrowser = t()[0].toLowerCase();
        versionBrowser = t()[1];

        var webKit = 'safari;chrome';
        var IE = 'netscape;msie';
        var mozilla = 'firefox';

        var browserName = [
            (that.options.useOnMozilla ? mozilla : ''),
            (that.options.useOnWebKit ? webKit : ''),
            (that.options.useOnIE ? IE : '')
        ].join(';');

        var neededBrowser = browserName.indexOf(currentBrowser) !== -1;

        if (neededBrowser) {
            ssc_addEvent("mousedown", ssc_mousedown);
            if (currentBrowser === 'firefox' || currentBrowser === "msie" || currentBrowser === "netscape") {
                ssc_addEvent("wheel", ssc_wheel);
            } else {
                if (currentBrowser === 'chrome' && parseInt(versionBrowser) >= 61) {
                    // Use scrollingElement for smooth scrolling using keyboard
                    currentScrollingElement  = document.scrollingElement;
                    // Here is used native chrome smooth scrolling for wheel.
                } else {
                    ssc_addEvent("mousewheel", ssc_wheel);
                }
            }
            ssc_addEvent("load", ssc_init);
        }
    });

The listener has wrong assumptions, that wheelDelta* has the same sign of delta* (it's the opposite!) and that Firefox always uses DOM_DELTA_LINE for deltaMode.

    function ssc_wheel(e) {
        if (!ssc_initdone) {
            ssc_init();
        }
        var t = e.target;
        var n = ssc_overflowingAncestor(t);
        if (!n || e.defaultPrevented || ssc_isNodeName(ssc_activeElement, "embed") || ssc_isNodeName(t, "embed") && /\.pdf/i.test(t.src)) {
            return true;
        }
        var r = e.wheelDeltaX || e.deltaX || 0;
        var i = e.wheelDeltaY || e.deltaY || 0;
        if (n.nodeName === 'BODY' && (currentBrowser === 'firefox' || currentBrowser === "msie" || currentBrowser === "netscape")) {
            n = document.documentElement;
            r = -r;
            i = -i;
            if (currentBrowser === 'firefox') {
                r *= 40;
                i *= 40;
            }
        }

        if (!r && !i) {
            i = e.wheelDelta || 0;
        }
        if (Math.abs(r) > 1.2) {
            r *= that.options.stepsize / 120;
        }
        if (Math.abs(i) > 1.2) {
            i *= that.options.stepsize / 120;
        }
        ssc_scrollArray(n, -r, -i);
    }

Because wheelDelta* has the wrong sign, every time the scroll happens the page goes the opposite direction, and because of the *= 40 part the scroll becomes way too fast.

We can either:

  • Delete wheelDelta* properties and force DOM_DELTA_LINE
  • or just pretend it's Chrome.
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Status: RESOLVED → UNCONFIRMED
Ever confirmed: false
Resolution: FIXED → ---
Status: UNCONFIRMED → NEW
Ever confirmed: true

Is webcompat:needs-diagnosis accidental?

Flags: needinfo?(twisniewski)

Yes, sorry, removed.

Webcompat Score: 5 → 6
Depends on: 1679111
Flags: needinfo?(twisniewski)
Priority: P3 → P2

Delete wheelDelta* properties and force DOM_DELTA_LINE

That doesn't seem feasible (also with touchpads there might not be a reasonable DOM_DELTA_LINE value... Guess we can convert and fake it?)

or just pretend it's Chrome

Seems easier for this site at least, specially since we don't think this is widespread given comment 3

It actually works fine on my end just to flip wheelDeltaY and scale it down by 40 (it was easy to write such an intervention).

But if that's not going to work well on other platforms, and I ought to also check for wheelMode and such, I'll update.

Assignee: nobody → twisniewski
Status: NEW → ASSIGNED
Webcompat Score: 6 → 5
Pushed by twisniewski@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7a31c48bec94 https://hg.mozilla.org/integration/autoland/rev/bfd05d0c8c57 add a desktop-only JS intervention for www.ilgeniodellapizza.com to fix broken wheel-scrolling; r=denschub,webcompat-reviewers
Webcompat Score: 5 → 1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: