Closed Bug 1520581 Opened 7 years ago Closed 5 years ago

Descendant 'overflow: hidden' elements with auto height can prevent effective scroll anchoring

Categories

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

66 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox66 --- wontfix
firefox77 --- fixed

People

(Reporter: StefanG_QA, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Whiteboard: [layout:backlog:quality])

Attachments

(2 files)

Mozilla/5.0 (Android 8.1.0; Mobile; rv:66.0) Gecko/66.0 Firefox/66.0 (20190116093310)

STR:
1 Open Firefox.
2 Go to https://www.rottentomatoes.com/m/mechanic_resurrection/
3 Scroll down all the way to "Movie Info" section while the other sections aren't loaded

ER: Solid scroll position
AR: The page jump once the content is fully loaded

The same behavior could be observed in the responsive design mode.

https://St3fQA.tinytake.com/sf/MzIzNDMzNF85NjkxMzAz

Flags: needinfo?(rhunt)
Priority: -- → P3

It looks like we we're not able to select a scroll anchor on this page on mobile.

The reason is that the bulk of the page is contained inside a 'overflow: hidden' div. That element is a scroll frame so it can select a scroll anchor, but the root scroll frame can't select one inside it. This div is never actually scrolled, so it never selects an anchor for itself.

I now know why the Chrome implementation can select scroll anchors within descendant scrollable elements. That works around this situation by allowing the root scroll frame to select an anchor inside these 'overflow: hidden' divs. We'll probably want to support the same thing.

Assignee: nobody → rhunt
Flags: needinfo?(rhunt)
Summary: Rottentomatoes jump when content is fully loaded with scroll anchoring → Descendant 'overflow: hidden' elements with auto height can prevent effective scroll anchoring

Note, the situation here isn't worse than without scroll anchoring. So I'm categorizing this as a future improvement.

Here's a minimal test case that demonstrates the issue.

In this test, #hidden generates a scrolling box (per spec), which causes us to be unable to select an anchor inside of it. But it's also never scrolled and never overflows because it has 'height: auto', making it appear like any other div.

One possible solution would be to allow us to select an anchor inside of another scrolling box if it is unable to be scrolled in the block direction (because it doesn't overflow).

The tricky thing is that ownership of the anchor node is currently tied to the nearest ancestor scroll frame. We'd need to be careful to maintain a clear ownership policy.

Blocks: 1525586
Depends on: 1629237
Assignee: rhunt → nobody
Whiteboard: [layout:backlog:quality]

As long as the nested scrollframe doesn't maintain an anchor itself.

This is important for pages which use overflow: hidden to contain large
parts of their scrollable content, see bug 1629237 for an example.

When calling InvalidateAnchor(), we may invalidate an ancestor anchor
itself, if we're not maintaining an anchor and our scrolled frame is
part of the anchor chain. This is important to maintain our state
properly.

I was going to add some assertion to this effect but it can fail when
fragmenting inlines already, so for now I've commented it out and filed
bug 1629280 for that. It's not great, but it cannot lead to a security
issue so we probably can fix it with time.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ace4bfaec686 Allow to select scroll anchors inside nested scroll frames. r=dholbert
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Regressions: 1630385
Regressions: 1629711
Regressions: 1631212
Regressions: 1538537
Regressions: 1638865
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: