IntersectionObserver callback does not fire for zero-height element at the bottom of the document at some DPI scales (which breaks infinite-scroll on some sites)
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: dholbert, Assigned: hiro)
References
(Depends on 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
1022 bytes,
text/html
|
Details |
STR:
- Make sure Firefox for Android has the dynamic toolbar enabled (this is the default config "Scroll to hide toolbar" enabled)
- Load attached testcase.
- Scroll to the very bottom of the page.
EXPECTED RESULTS:
The background should turn lime when you reach the bottom.
ACTUAL RESULTS:
The background never turns lime. It just stays pink.
I'm pretty sure this is the root cause of bug 1884144 at Taobao.
Firefox 127 release and 129 Nightly on Android give ACTUAL RESULTS -- though if I turn off the dynamic toolbar, they give EXPECTED RESULTS.
Chrome gives EXPECTED RESULTS, as does Firefox on Desktop.
Reporter | ||
Comment 1•5 months ago
|
||
The setup in the testcase here is:
- zero-height element at the very end of the document.
- an IntersectionObserver watching for that element to come into view and reach an intersectionRatio of 1.
Obviously it's a bit edge-casey to consider whether a zero-height element at the end of the document is intersecting or not-intersecting when you're scrolled to the very end. (It's zero-height and it coincides precisely with the edge of the viewport, so it's not exactly on-screen.)
But apparently there's consensus that it is intersecting with an intersectionRatio of 1, based on the browsers/configs that yield EXPECTED RESULTS in comment 0. Only Firefox-with-dynamic-toolbar considers it non-intersecting.
Reporter | ||
Comment 2•5 months ago
|
||
I guess this is bug 1788504, actually.
Reporter | ||
Comment 3•4 months ago
|
||
Hmm, dupe-target bug 1788504 landed last week, but I'm still able to reproduce this bug here with the attached testcase, in Nightly 2024-07-22 (built from a m-c commit that landed yesterday, much more recently than bug 1788504's patches).
So bug 1788504 didn't fix this, i.e. this bug is not a dupe of bug 1788504 after all.
--> moving dupe relationship to see-also relationship. emilio or hiro, maybe you could take a look here?
Assignee | ||
Comment 4•4 months ago
|
||
FWIW, on my local built GeckoView example based on this revision, the test case sometimes works, sometimes doesn't work. Odd.
Assignee | ||
Updated•4 months ago
|
Assignee | ||
Comment 5•4 months ago
|
||
Since bug 1788504 the root scroll container's clipped region had been
over-clipped because GetScrollPortRectAccountingForMaxDynamicToolbar returns
the toolbar height divided by the current pinch zoom ratio. For example, given
that the toolbar height is 60px (in screen units) and the pinch zoom ratio is
2.0, then GetScrollPortRectAccountingForMaxDynamicToolbar returns 30px (in CSS
units), it's not sufficient for the clipped region.
The JUnit test in this change fails without this change, succeeds with this
change.
Updated•4 months ago
|
Comment 6•4 months ago
|
||
Comment on attachment 9416512 [details]
Bug 1905441 - Revert bug 1788504 partially. r?emilio
Revision D217924 was moved to bug 1909181. Setting attachment 9416512 [details] to obsolete.
Assignee | ||
Comment 7•4 months ago
|
||
The bug number was wrong. :/
Note that I can see this issue with static toolbar, FWIW.
Comment 8•4 months ago
•
|
||
This repros as well on desktop at some zoom levels, afaict. E.g., on 130% zoom I see:
window.innerHeight // 553
let div = document.createElement("div"); div.style = "position: fixed; inset: 0;"; document.documentElement.appendChild(div); // undefined
div.getBoundingClientRect().height // 553.9166870117188
myTarget.getBoundingClientRect().y // 554.0999755859375
So it seems that at some zoom levels we don't grow the scroll range to cover that?
This is likely to be due to this snapping here... Hiro, you have more context than me on that code, any idea of what is that trying to achieve?
Assignee | ||
Comment 9•4 months ago
|
||
I suspected it so that I tried to see with layout.scroll.disable-pixel-alignment=true
, but the issue still happened, that's what I did yesterday.
Now I tried it again before leaving the above comment, with layout.scroll.disable-pixel-alignment=true
the test case in comment 0 works fine on my Pixel 3 and on Android emulator. Maybe I didn't reload the test case after changing the pref.
Reporter | ||
Comment 10•4 months ago
•
|
||
I can confirm that the testcase works fine (changes to lime when I reach the end) if I set layout.scroll.disable-pixel-alignment=true
in Firefox Nightly on my Pixel 8.
Description
•