DOM scrollTop property resets on z-index change of parent container (div)




7 years ago
6 years ago


(Reporter: Avok, Unassigned)


1.9.2 Branch
Windows 7

Firefox Tracking Flags

(Not tracked)



(1 attachment)



7 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv: Gecko/20101203 Firefox/3.6.13
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv: Gecko/20101203 Firefox/3.6.13

I have a div with overflow-y: hidden; The dom object reference is called elementToScroll. Its parent dom object reference is called parentDiv.

I manage the scrolling of the content inside by setting the DOM property scrollTop from javascript like this for example: elementToScroll.scrollTop = 150;

This is needed for my custom scroll bar implementation.

I also need to change the z-index of the parentDiv with javascript. When I do that, the elementToScroll.scrollTop returs to 0. This is not happening with Chrome 8 or with IE 8 and is by no means normal. It is a major pain, because it also causes black rectangle to be diplayed over the entire parentDiv during the elementToScroll.scrollTop change. I cannot work around it.

Reproducible: Always

Steps to Reproduce:
1. change elementToScroll.scrollTop property to something other than 0
2. change = newIndex;
Actual Results:  
The elementToScroll.scrollTop returs to 0 and I experience brief flicker like black rectangle over the entire parentDiv.

Expected Results:  
The elementToScroll.scrollTop should stay the same when changes.



Built from
Build platform

Build tools
Compiler 	Version 	Compiler flags
cl 	14.00.50727.762 	-TC -nologo -W3 -Gy -Fdgenerated.pdb -DNDEBUG -DTRIMMED -Zi -UDEBUG -DNDEBUG -GL -wd4624 -wd4952 -O1
cl 	14.00.50727.762 	-GR- -TP -nologo -Zc:wchar_t- -W3 -Gy -Fdgenerated.pdb -DNDEBUG -DTRIMMED -Zi -UDEBUG -DNDEBUG -GL -wd4624 -wd4952 -O1


7 years ago
Version: unspecified → 3.6 Branch
Can you provide/attach a reduced Testcase showing your Issue?

Comment 2

7 years ago
Created attachment 502214 [details]
Use this to see the problem described

With pleasure :)

Comment 3

7 years ago
Toggling the visibility style also appears to reset the scroll position. This is a serious problem. Can you fix it, please?

Comment 4

6 years ago
This problem have been reported for many times for years now (including one report by myself).

Weird enough, now I can't seem to find any of the older bug-reports (like they have been deleted, but the BUG still remains).

Here is now to reproduce it:

I even had a developer saying it properly was an easy thing to fix, but nothing happened, except my long and loyal waiting.

Comment 5

6 years ago
Manage to find the old reports from my inbox:

As you can see nothing have happened over all this years, this must be the longest pending bug

Comment 6

6 years ago
An even older report of same bug:
Component: General → General
Product: Firefox → Core
QA Contact: general → general
Version: 3.6 Branch → 1.9.2 Branch
For what it's worth, the attached testcase doesn't seem to show the problem for me in a current trunk build...

Comment 8

6 years ago
Problem Remain (I'm using latest Nightly Build)

Try instead: (better example)
That's a totally different testcase, for a different bug.  Please don't conflate separate issues.

Comment 10

6 years ago
(In reply to Boris Zbarsky (:bz) from comment #7)
> For what it's worth, the attached testcase doesn't seem to show the problem
> for me in a current trunk build...

Yes, attachment 502214 [details] fails in Fx 3.6.17 and works in Fx 5
Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0

Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.