Scroll sequence sometimes ends with tiny backward scroll
Reported by
abrahams...@googlemail.com,
Aug 14
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.32 Safari/537.36 Steps to reproduce the problem: 1. Open a long web page with scroll bars such as https://bugs.chromium.org/p/chromium/issues/list and scroll half way down. 2. Hit F12 and paste this into the console: let prev = window.pageYOffset window.addEventListener("scroll", () => { const curr = window.pageYOffset const diff = curr - prev if (diff < 0) console.log(diff) else console.warn(diff) prev = curr }) 3. Repeat the following: Scroll down Scroll up What is the expected behavior? Scrolling down should only produce positive changes of pageYOffset. Scrolling up should only produce negative changes of pageYOffset. What went wrong? Sometimes the scroll ends with a tiny scroll step backward. I.e. when scrolling up, the sequence ends with a minimal scroll-down that should not have happened. Did this work before? N/A Does this work in other browsers? Yes Chrome version: 69.0.3497.32 Channel: beta OS Version: 10.0 Flash Version: I tested this with 5 different mice/touchpads on Mac/Windows. I was able to reproduce this in Chrome Beta, Chrome Canary, and Opera. I was not able to reproduce this in Edge or Firefox.
,
Aug 14
Able to reproduce the issue on Mac 10.13.3, Win-10 and Ubuntu 17.10 using chrome reported version #69.0.3497.32 and latest canary #70.0.3522.0. This is a non-regression issue as it is observed from M60 old builds. Hence, marking it as untriaged to get more inputs from dev team. Thanks...!!
,
Aug 16
I can repro on Windows 70.0.3523.0. Seems to only happen when scrolling down. My guess is that the scroll lands on a fractional pixel and we floor it, causing a negative scroll so it's technically correct. Not sending a scroll here means an app trying to keep up with the scroll could accumulate error as a result. We could maybe do a little better here by avoiding the fractional bit of the scroll but that would require a bit of thought and I don't think this is high priority. Is this causing a real-world breakage or pain in some way?
,
Aug 17
Hi Bokan, thanks for taking a look. > Seems to only happen when scrolling down. Not sure what you mean, I'm scrolling up. > Is this causing a real-world breakage or pain in some way? We toggle things when scrolling up (like backt to top button) but sometimes they unintentionally disappear. It seems as if the user has scrolled back down when he has not.
,
Aug 17
> Not sure what you mean, I'm scrolling up. The issue occurred for me regularly when I would scroll down but never when I scroll up. > We toggle things when scrolling up (like backt to top button) but sometimes they unintentionally disappear. It seems as if the user has scrolled back down when he has not. Ok - That's fairly compelling. It's easy to work around so not high priority but we should probably fix it. +eirage@ since you're steeped in precision issues. PTAL when you get a chance. |
||||
►
Sign in to add a comment |
||||
Comment 1 by phanindra.mandapaka@chromium.org
, Aug 14