ilgeniodellapizza.com - Scroll does not work correctly
Categories
(Web Compatibility :: Site Reports, defect, P2)
Tracking
(Webcompat Score:1, Webcompat Priority:P2, 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)
Environment:
Operating system: Windows 11
Firefox version: Firefox 130.0.1 (release)/131/133
Preconditions:
- Clean profile
Steps to reproduce:
- Navigate to: http://www.ilgeniodellapizza.com/le-nostre-pizze.html
- 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
Updated•10 months ago
|
Updated•7 months ago
|
Updated•6 months ago
|
Updated•5 months ago
|
Comment 1•1 month ago
•
|
||
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.
Comment 2•1 month ago
|
||
This seems to be a version of https://github.com/gblazex/smoothscroll-for-websites
Comment 3•1 month ago
|
||
That one seems to have the proper check since forever though 👀 https://github.com/gblazex/smoothscroll-for-websites/blame/809448fe88022ae0f102f687abe0028cbe8c1112/SmoothScroll.js#L352-L361
Updated•1 month ago
|
Updated•1 month ago
|
Assignee | ||
Updated•1 month ago
|
Assignee | ||
Comment 5•1 month ago
|
||
Yes, sorry, removed.
Comment 6•1 month ago
|
||
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
Assignee | ||
Comment 7•1 month ago
•
|
||
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 | ||
Comment 8•1 month ago
|
||
Updated•1 month ago
|
Updated•1 month ago
|
Comment 10•28 days ago
|
||
bugherder |
Assignee | ||
Updated•28 days ago
|
Updated•28 days ago
|
Description
•