New issue
Advanced search Search tips

Issue 766938 link

Starred by 4 users

Issue metadata

Status: Duplicate
Merged: issue 157855
Owner: ----
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

document.body.scrollTop always is 0

Reported by yhsi...@appier.com, Sep 20 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36

Steps to reproduce the problem:
1. Give body enough height (ex: 2000px)
2. scroll window
3. call document.body.scrollTop
4. alway get zero value 
5. reproduce here. http://jsbin.com/sawufojebo/1/edit?html,css,js,console,output

What is the expected behavior?
when scroll the window, browser should give the right scrollTop value.

What went wrong?
document.body.scrollTop do not return the right value when you scrolling the window.

Did this work before? Yes 60.0.3112.113

Does this work in other browsers? N/A

Chrome version: 61.0.3163.91  Channel: stable
OS Version: OS X 10.12.6
Flash Version: 

related with https://bugs.chromium.org/p/chromium/issues/detail?id=706971&q=document.body.scrollTop&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified

But not only fullscreen mode
 
Components: Blink>JavaScript>API Blink>Scroll

Comment 2 Deleted

Comment 3 Deleted

Comment 4 by yhsi...@appier.com, Sep 20 2017

I think it's related with this issue.
https://bugs.chromium.org/p/chromium/issues/detail?id=157855

Mergedinto: 157855
Status: Duplicate (was: Unconfirmed)
Yes  issue 157855  was fixed and now causes the issue you reported. Chrome now matches firefox.

See https://dev.opera.com/articles/fixing-the-scrolltop-bug/
and

https://groups.google.com/a/chromium.org/d/msg/blink-dev/X64Sg16RhT4/6ZiW7Dt8CAAJ

You should likely be using document.scrollingElement.scrollTop to set the scrollTop.

If you are looking for an interoperable way of querying scrollTop you can use the window.scrollY attribute or doing something like document.documentElement.scrollTop || document.body.scrollTop


Still nothing of this seems to work...

Sign in to add a comment