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

RESOLVED WORKSFORME

Status

()

Core
General
RESOLVED WORKSFORME
7 years ago
6 years ago

People

(Reporter: Avok, Unassigned)

Tracking

1.9.2 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) 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 parentDiv.style.zIndex = 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 parentDiv.style.zIndex changes.

about:buildconfig

Source

Built from http://hg.mozilla.org/releases/mozilla-1.9.2/rev/0c159bd1d600
Build platform
target
i686-pc-mingw32

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
(Reporter)

Updated

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

Comment 2

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

With pleasure :)
(Reporter)

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:
http://1ntt.net/firefoxbug.htm

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:

https://bugzilla.mozilla.org/show_bug.cgi?id=571201

https://bugzilla.mozilla.org/show_bug.cgi?id=436650

https://bugzilla.mozilla.org/show_bug.cgi?id=386444

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:

https://bugzilla.mozilla.org/show_bug.cgi?id=343254
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)
https://bug343254.bugzilla.mozilla.org/attachment.cgi?id=227695
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

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