Closed Bug 1951021 Opened 5 months ago Closed 4 months ago

Consider scrolling visually to position:fixed descendants on scrollIntoView call

Categories

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

defect

Tracking

()

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: hiro, Assigned: hiro)

References

(Blocks 1 open bug)

Details

(Keywords: webcompat:platform-bug)

Attachments

(2 files)

Attached file an example

While I was trying to understand what's going on bug 1946409 case, I realized bug 1943865 wasn't sufficient for some cases.

For example, if the target element of scrollIntoView call is inside a tall position:fixed element, say, its height is 100vh and the document is scaled down by 2.0x or some. Then the target element will never be scrolled into the visual viewport.

Attaching file is an example. If you open the example in RDM and click the "scrollIntoView" button, nothing will happen. It should be scrolled to the blue banner at the bottom of the page. You can see the expected result on Chrome RDM.

Blocks: 1946409
No longer blocks: 1943053
See Also: → 1943053

It turned out the height of the position:fixed element doesn't matter here. A problem is that the target element is inside nested position:fixed elements.

While we are walking up the frame tree during for calculating the frame
bounds, there are cases that we reach to the top viewport frame. Thus
when we walk up the frame tree to invoke ScrollToShowRect for each
scroll container, we fail the check introduced in bug 1943865.

Just like we did in bug 1943865, this commit has also two tests, one is
a web platform test, the other is a mochitest. But unlike bug 1943865,
the mochitest in this commit doesn't use zoomToFocusedInput since
zoomToFocusedInput ends up calling another
PresShell::ScrollFrameIntoView call via Selection::ScrollIntoView [1], which
wallpapers this bug, i.e the mochitest will get pass without this proper
fix.

[1] https://searchfox.org/mozilla-central/rev/cb46268bc26b0cd9e91e625aa92aaa5a6f047b9d/dom/base/Selection.cpp#3654

Assignee: nobody → hikezoe.birchill
Status: NEW → ASSIGNED
See Also: → 1953721

The severity field is not set for this bug.
:hiro, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(hikezoe.birchill)
Pushed by hikezoe.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/46d8b0651f44 Check whether the given frame is position:fixed inside the loop where we calculate the frame bounds. r=dlrobertson
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/51447 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Flags: needinfo?(hikezoe.birchill)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: