Closed Bug 268111 Opened 20 years ago Closed 20 years ago

[FIX]position: fixed elements are positioned relative to the page rather than the viewport

Categories

(Core :: Layout: Positioned, defect, P5)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: bugzilla-mozilla-20000923, Assigned: bzbarsky)

References

()

Details

(Keywords: regression, testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041106 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041106 Firefox/1.0

When loading a page with a position: fixed element on it (see the URL), the
element is positioned against the page itself, rather than the viewport - even
though it is anchored to the viewport when you scroll.

Reproducible: Always
Steps to Reproduce:
1. Load the URL.
2. Scroll down.
3. Reload (not shift-reload, as that resets the scorll-position). You can also
just resize the window for this step.

Actual Results:  
The position: fixed header vanishes.

Expected Results:  
The position: fixed header should still be anchored to the top-left of the viewport.

It appears to be positioning the fixed element against the page, so if you only
scroll down 1 line and then resize/reload the position: fixed element is then
locked partially off the top of the viewport.

Each time a reflow occurs (reload or resize window) the element is re-anchored
based on the scroll position of the page.

This bug is currently causing ChatZilla to not have any header boxes, as they
use position: fixed (that's how I found it :) ).
This regression is pretty recent, I believe, as I have only noticed it the past
couple of days - it happens on my 2004110603 build, and CTho's 20041104 build,
but (for reference) not Firefox 1.0 branch. I'm going to try to get some nightly
builds now, but my initial guess is that it's regressed in the past week or two
at most.
Keywords: regression, testcase
2004-11-01-06 is OK.
2004-11-03-07 is OK.
2004-11-04-07 is broken.

(Windows zip builds from ftp.mozilla.org)

http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2004-11-03+05%3A00&maxdate=2004-11-04+07%3A00&cvsroot=%2Fcvsroot

The check-in for bug 266968, at 2004-11-03 08:16, would seem a likely place to
start looking.
CCing bz since his bug looks related.
The problem is that the CSS specification is somewhat self-contradictory here.

1)  The fixed-position div should not move when we scroll.
2)  Since it has auto top and bottom, its position depends on where it would
    show up if it were statically positioned.
3)  Where it would show up if statically positioned depends on the scroll
    position.

Note that before the checkin for bug 266968 we mishandled scrolling when
calculating static positions.  So the testcase in this bug rendered
consistently, but absolutely positioned divs wouldn't render right if things got
scrolled.  Now we account for the scroll position correctly, and this bug results.

I've sent mail to www-style@w3.org regarding this inconsistancy... let's see
what they say.  Taking, I guess.

As for Chatzilla, I recommend specifying some offsets.  You might want to file a
separate bug on that.
Assignee: nobody → bzbarsky
OS: Windows 2000 → All
Priority: -- → P5
Hardware: PC → All
Target Milestone: --- → mozilla1.8beta
The mail I sent is at
http://lists.w3.org/Archives/Public/www-style/2004Nov/0031.html

Note that my proposed changes to the spec to remove the contradiction will
probably leave chatzilla broken if implemented.
Ah, it turns out it was only my custom output window that lacked a top property
for the header in ChatZilla - the built-in one does specify top: 0px and is thus
not affected by this change in behaviour.
Whiteboard: [waiting on WG to decide something]
*** Bug 273177 has been marked as a duplicate of this bug. ***
Depends on: 276154
No longer depends on: 276154
*** Bug 276154 has been marked as a duplicate of this bug. ***
Attached patch FixSplinter Review
This restores the old behavior of using the static position with all scrollable
things scrolled to default position.... I suspect we do want to keep backwards
compat here, unfortunately.  :(
Attachment #170755 - Flags: superreview?(dbaron)
Attachment #170755 - Flags: review?(dbaron)
Summary: position: fixed elements are positioned relative to the page rather than the viewport → [FIX]position: fixed elements are positioned relative to the page rather than the viewport
Whiteboard: [waiting on WG to decide something]
Comment on attachment 170755 [details] [diff] [review]
Fix

r+sr=dbaron (assuming you're restoring old code, didn't really look)
Attachment #170755 - Flags: superreview?(dbaron)
Attachment #170755 - Flags: superreview+
Attachment #170755 - Flags: review?(dbaron)
Attachment #170755 - Flags: review+
Attached file testcase
attaching testcase from URL here so it won't get lost
Yes, this is restoring the old code.  Checked in for 1.8b.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
This bug is back again on trunk (not in FF 1.5). Reopen or new bug?

New testcase: http://silver.warwickcompsoc.co.uk/temp/pos_fixed_jump.html
New bug, and please cc me.  But that URL gives me a 503; please attach a testcase to the bug you file?
Filed bug 331729 and broke the knee-caps of the guy admining the server. ;)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: