Content moves down in the scrollport, when a reflow occurs, with "float:left;position:sticky" element followed by some cleared tall content
Categories
(Core :: Layout: Positioned, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox146 | --- | affected |
People
(Reporter: dholbert, Unassigned)
References
(Blocks 4 open bugs)
Details
(Keywords: parity-chrome, parity-edge, webcompat:platform-bug)
User Story
user-impact-score:880
Attachments
(3 files, 2 obsolete files)
[I'm spinning this off from bug 1618029 comment 3. Thanks to @toulousevictor for the bug report over there.]
STR:
- Click the pin/thumbtack icon at the top left.
- Load attached testcase (original URL: https://jsfiddle.net/vctls/mac2Ls0d/16/ )
- Scroll down and hover the green folder icon at the very bottom.
EXPECTED RESULTS:
A "shrink" animation should play on the folder.
ACTUAL RESULTS:
- All of the content from the top of the page seems to snap into the current position of the scrollport
- The folder icon gets thrown off the bottom (creating additional scrollable area)
- If you try to scroll up, there's a bunch of blank space before the content now.
Chrome gives EXPECTED RESULTS.
Firefox Nightly 104 gives ACTUAL RESULTS.
(Note: It seems possible this is a version of https://bugzilla.mozilla.org/show_bug.cgi?id=1748891 )
| Reporter | ||
Comment 1•4 years ago
|
||
Here's a reduced testcase.
STR here:
- Scroll the scrollable area to the bottom.
- Repeatedly hover/unhover the "Hover me" text.
ACTUAL RESULTS: The scrollbar shows that the scrollable area keeps getting taller (with the content all being moved to the very end).
| Reporter | ||
Comment 2•4 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #0)
(Note: It seems possible this is a version of https://bugzilla.mozilla.org/show_bug.cgi?id=1748891 )
The interesting wrinkle here:
- the sticky-positioned thing is also a float
- the content that's "propping up" the furthest scrollable area is not itself sticky-positioned, though it is cleared to be below the sticky float, and that clearance seems to be necessary to trigger the bug. (In the original testcase it's cleared via
width:100%which forces it below the float so that it fits; in testcase 2, I clear it explicitly viaclear:both.)
| Reporter | ||
Updated•4 years ago
|
Comment 3•2 years ago
|
||
This is kind of reminiscent of bug 1797307, I wonder if it's a duplicate.
| Reporter | ||
Comment 5•1 year ago
|
||
Comment on attachment 9287106 [details]
testcase 1 (from reporter) note: depends on external cloudflare-hosted CSS libraries
Sorry, I think testcase 1 must've been the completely wrong file-attachment here. Fortunately the jsfiddle link is still valid. Let me repost a version of that.
| Reporter | ||
Comment 6•1 year ago
|
||
Here's a bugzilla-hosted version of the jsfiddle. This still reproduces the bug for me (though testcase 2 is more reduced and probably better for reasoning about).
The jsfiddle version uses fontawesome for some icons; I replaced the fontawesome stuff with just regular descriptive text ("STEP 1... STEP 2")
| Reporter | ||
Comment 7•1 year ago
|
||
Updated•1 year ago
|
Comment 8•1 year ago
|
||
Moving into Layout: Positioned.
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 9•7 months ago
•
|
||
(In reply to Daniel Holbert [:dholbert] from comment #1)
Created attachment 9287108 [details]
testcase 2 (reduced)Here's a reduced testcase.
STR here:
- Scroll the scrollable area to the bottom.
- Repeatedly hover/unhover the "Hover me" text.
ACTUAL RESULTS: The scrollbar shows that the scrollable area keeps getting taller (with the content all being moved to the very end).
I am playing with the reduced testcase 2. One interest thing is, if we don't scroll to the bottom, e.g. scrollTop = 50, the unexpected empty content (i.e. the displacement of the content) becomes smaller. i.e. The scroll position has impact on the displacement of the unexpected movement, and it seems the reflow wants to put the content to the position without the scroll (i.e. it doesn't align the current scroll position I guess).
Comment 10•7 months ago
|
||
Yeah I suspect there's a layout ordering issue. Sticky content usually lays out in-flow, but floats change that, and they may also be laid out multiple times. We probably need to consider the normal position for floating content in general. I guess another interesting case is what happens with float + position: relative. What area do we actually exclude from the flow? Does that match other browsers?
Comment 11•7 months ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #10)
I guess another interesting case is what happens with
float+position: relative. What area do we actually exclude from the flow? Does that match other browsers?
Not sure how related it is, but one known browser inconsistency related to the combination of position:relative and float that we have come across is bug 2002443.
Comment 12•7 months ago
|
||
Adding FMPoV related oddity spotted in SO question: here the trigger for "inserting" the odd blank space is page reload. Also, any next reflow triggered by page zoom or resize makes the odd blank space disappear.
Str:
- Load the page.
- Scroll down.
- Reload the page.
- Scroll up.
Expected
After reload, document height is preserved and either same scroll position kept (preferably), or viewport at the beginning of the page (like other browsers do; not related to this issue). No extra space above the Cleared block. (Large crimson text that reads "HA!" remains hidden under the Cleared block.)
Actual
After reload, top border of the Cleared block is in the viewport and more scrollable space appears above it, so the page can become progressively taller with each reload. Large crimson text that reads "HA!" is unleashed from beneath the Cleared block.
It seems that the odd blank space's height is related to the scroll position prior to the reload.
Updated•7 months ago
|
Comment 13•7 months ago
|
||
Comment on attachment 9557207 [details]
testcase 3 (reload-induced scroll offset grow)
(Ah, sorry, re-tested again with clean profiles and realised it is not a clean MRE, so disregard the previous remark. Sorry for the noise.)
Comment 14•7 months ago
•
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #10)
I guess another interesting case is what happens with
float+position: relative. What area do we actually exclude from the flow? Does that match other browsers?
I tried the case with float + position: relative, and the behavior matches other browsers. (i.e. Cannot reproduce this bug with this setting.) I guess we have to exclude the offsets (e.g. top, left, scroll offset) from the flow, to match other browsers
Still have to dig deeper, but I'd like to put some notes from my investigation last week.
- So basically, we hit this bug because we placed the frame with
clear:bothat the wrong block coordinate (i.e.BStart(WM)). This wrong block coordinate is due to the incorrectclearancevalue when reflowing this frame. - This
clearancevalue comes from the float manager (nsFloatManager::ClearFloats()). In the float manager, we use the latest FloatInfo (i.e. the frame from the element withposition:sticky; float:leftin the test) as the reference to compute the clearance. - The
FloatInfowas added during the incremental reflow. And we usensFloatManager::GetRegionFor()to get its region.
So in the reduced test, I noticed the region includes the scroll offset. (For example, if scrollTop = 20, the BStart value of this region is 1200). That's why our final clearance includes the scroll offset. We don't have this issue when using position:relative; float:left because its logical rect doesn't include the scroll offset. We probably have to tweak the region value for sticky positioned element but I'm not sure where is the suitable place to adjust it.
Also, I can reproduce this bug without scrolling. Just change the top value of this position:sticky; float:left; element to be non-zero, e.g. 100px After reflowing, we still get the wrong block coordinate for the element with clear:both.
<style>
#scrollable { height: 300px; width: 300px; }
#split { height: 1px; clear: both; }
#overflowing { height: 200; background: gray; }
#sticky-box-label {
position: sticky;
top: 100px;
float: left;
background: yellow;
}
</style>
<script>
function run() {
window.setTimeout(() => {
let box = document.getElementById('overflowing');
box.style.left = "1px";
}, 500);
}
</script>
<body onload="run()">
<div id="scrollable">
<label id="sticky-box-label">Sticky</label>
<div id="split"></div>
<div id="overflowing"></div>
</div>
</body>
(In reply to Botond Ballo [:botond] from comment #11)
Not sure how related it is, but one known browser inconsistency related to the combination of
position:relativeandfloatthat we have come across is bug 2002443.
Probably related to bug 2002443 but it doesn't use clear:both. We may check it once we figure out this bug.
Updated•6 months ago
|
Description
•