Closed Bug 1598112 Opened 5 years ago Closed 5 years ago

element with position: sticky and top: 100%; makes its parent to have infinite scrollbar

Categories

(Core :: Layout: Scrolling and Overflow, defect, P2)

70 Branch
All
Unspecified
defect

Tracking

()

VERIFIED FIXED
mozilla73
Tracking Status
firefox73 --- verified

People

(Reporter: ksenia, Assigned: TYLin)

References

()

Details

Attachments

(3 files, 1 obsolete file)

Attached file 44780.html

As reported in https://github.com/webcompat/web-bugs/issues/44780

STR:

  1. On Firefox for Android visit https://sp.nicovideo.jp/ and try scrolling to the end of the page

Expected:
Can see the footer at the bottom of the page

Actual:
Can't reach the bottom of the page

There is a overflow-x rule on both html and body, and removing either of them fixes the issue

html, body {
    overflow-x: hidden;
}

I've also attached a reduced test case.

Thanks for the reduced test case. FWIW, this can also be reproduced on desktop browsers.

The infinite scrolling doesn't look good, and it affects a real site.

Component: Layout → Layout: Scrolling and Overflow
Flags: needinfo?(aethanyc)
Priority: -- → P2

Is it really unexpected? If you stick something to the viewport that's larger than the viewport, I think expanding the viewport is ~expected?

Per spec 6.2. Sticky positioning

However, if sticky positioning causes an overflow: auto or overflow: scroll box to have overflow, the user agent must allow the user to access this content (at its offset position), which, through the creation of a scrolling mechanism, may affect layout.

It sounds like the sticky element should be able the enlarge the overflow area initially of the scroll container base on its 'top', 'left, etc, but it shouldn't "stick" there forever while scrolling to further enlarge the overflow area.

Flags: needinfo?(aethanyc)

This bug affects ordinary overflow scroll container.

In this test, Firefox cannot scroll to the purple rectangle in case 1 and case 2, while Google Chrome can in all cases. But Chrome didn't allow a sticky element to create an overflow area as case 1 shows.

Assignee: nobody → aethanyc

(In reply to Ting-Yu Lin [:TYLin] (UTC-8) (Traveling Nov 23 - Dec 15) from comment #3)

It sounds like the sticky element should be able the enlarge the overflow area initially of the scroll container base on its 'top', 'left, etc, but it shouldn't "stick" there forever while scrolling to further enlarge the overflow area.

This sounds related to the issue I brought up in https://github.com/w3c/csswg-drafts/issues/2794 ("Clarify whether sticky-positioned elements' residual position can cause scrollbars to remain, when a tall thing is removed")

The spec text in comment 3 is just saying that the sticky-positioned element creates scrollable overflow, I think. It's not obvious to me that that language is meant to put an additional constraint on the sticky-position of the element. (Note that the spec uses the exact same language when describing position:relative elements -- so it's not spec-text that someone crafted specially to ensure that sticky positioned elements remain scrollable.)

My gut feeling here is that we need spec clarification on this general issue of sticky-elements-beyond-the-reach-of-the-scrollport before shaking things up too much here, so I'm hesitant to take this patch unless it were clearly-correct/compatible. And I don't think it is clearly-compatible, right now, because Chrome fails the first half of the included WPT test (on my machine at least)...

See Also: → 1462235

(In particular, the above-linked spec issue https://github.com/w3c/csswg-drafts/issues/2794 would presumably have some bearing here, and the in-spec issues #2, 3, and 6 all kinda need to be addressed and would have some bearing on what we do here.)

Also: bug 1585254 is related & perhaps the same core issue.

I'm uneasy making this change without a coherent mental model for how this is supposed to work & what we'd like the spec to say about this.

(In reply to Daniel Holbert [:dholbert] from comment #7)

My gut feeling here is that we need spec clarification on this general issue of sticky-elements-beyond-the-reach-of-the-scrollport before shaking things up too much here, so I'm hesitant to take this patch unless it were clearly-correct/compatible. And I don't think it is clearly-compatible, right now, because Chrome fails the first half of the included WPT test (on my machine at least)...

Right. The spec isn't crystal clear about how to deal with the overflow area creating by the sticky elements. I think what Google Chrome does is simply to restrict the sticky element's position to the overflow area established by other elements within the same containing block. So in effect, the sticky elements cannot enlarge the overflow area.

If we want a compatible behavior with Chrome and fix the real site issue, I think the patch can be simpler. Though we'll have to give up passing this test position-sticky-offset-overflow.html, and it may be ok since no other engines pass it.

Attachment #9112817 - Attachment is obsolete: true
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b2e78ee1b18e Use scrolled frame's overflow rect as a the bounding box for position:sticky elements. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/20898 for changes under testing/web-platform/tests
Flags: needinfo?(aethanyc)
Upstream PR was closed without merging
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/c2b76b215034 Use scrolled frame's overflow rect as a the bounding box for position:sticky elements. r=emilio
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Upstream PR merged by moz-wptsync-bot
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
Flags: needinfo?(aethanyc)

Hi, from mobile side the issue is fixed, the user can reach at the bottom of the page, the footer is visible, checked with Sony Xperia Z5 (Android 7.0.0), Samsung Galaxy S8+ (Android 8.0.0) and Google Pixel 3a (Android 9) on Firefox Preview Nightly 200113 (Build #20130606) and GV: 74.0a1-20200110095023.
Test Data:

Flags: qe-verify+

Confirmed issue with 72.0a1 (2019-11-20) on Windows 10.
Fix verified with 73.0b6 on Windows 10, macOS 10.15, Ubuntu 18.04.

Possible issue uncovered while verification on Windows 10 still, noted on bug 1609915.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
See Also: → 1609915
See Also: → 1612561
Regressions: 1681997
Duplicate of this bug: 1314422
See Also: → 1830023
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: