Closed Bug 1856088 Opened 11 months ago Closed 11 months ago

Scroll anchoring causes jumps (probably due to incorrect relative scroll position updates)

Categories

(Core :: Panning and Zooming, defect, P2)

defect

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox119 --- wontfix
firefox120 --- wontfix
firefox121 --- fixed

People

(Reporter: hiro, Assigned: hiro)

References

Details

Attachments

(4 files)

Attached file A test case β€”

While I was trying to create a test case for bug 1779404, I happened to create another variant of test cases causing scroll position jumps. This test case isn't fixed by the fix for bug 1779404, so I suppose there's another underlying issue on our relative scroll position update stuff.

As far as I can tell with the fix for bug 1779404 I don't see any scroll position jumps on Facebook, so I am assuming this case is unrelated to the facebook case. Setting P3:S3 for the reason, but if we received new reports about scroll jumps on Facebook, we will raise this severity.

See Also: → 1858022
Attached file Another test case β€”

This is tough.

After chatting with Botond and Timothy on Matrix, I thought using pure scroll position update for scroll anchor adjustment is promising. But in fact it's not, it's not at all.

For example in the cases such as bug 1852818, a scroll anchor adjustment happens in a setTimeout callback due to expanding an element's height above the anchor, and then in a scroll event handler a scroll anchor adjustment happens due to restoring the expanded element. Say something like; the first adjustment +500px pure relative update and the second one is -500px adjustment. They are going to be handled in a single NotifyLayersUpdated call. Then unfortunately we clamp the scroll offset on every update, so that the first update doesn't result +500px change, but the second one result -500px. We might want to defer the clamp later? It won't work if there's a Element.scrollBy call in between the scroll anchor adjustments, we may end up having more scroll related metrics in each ScrollPositionUpdate and use them in each updating functions. I don't think that's a good idea though.

So I'd rather introduce a new scroll position update type, it's an absolute update but it will be merged into the running async scroll animation. That's will be most stable in terms of scroll anchoring because scroll anchor adjustment wants literally to scroll the given destination, i.e. the anchor element position.

I've implemented it locally and it works fine as far as I can tell. And it looks also fine on a try run.

Also note that I implemented it behind a new pref so that we can disable it if it were problematic.

This test is a test case where a scroll anchor adjustment happens while an
async scroll animation is running. Without the dumped metrics it's hard to tell
what's wrong. In fact the test fails if we did use ScrollUpdateType::Absolute
for scroll anchoring

Assignee: nobody → hikezoe.birchill
Status: NEW → ASSIGNED

Depends on D190887

Bumping up the priority.

Priority: P3 → P2

any progress on this? It's been going on for ages.

(In reply to Brinke Guthrie from comment #6)

any progress on this? It's been going on for ages.

There is a patch posted for this. I did a round of review on it today. It should be merged in the near future, and the fix will appear in Firefox 121 and possibly be backported to Firefox 120.

Note that this is just one of several recent fixes for these kinds of symptoms. Others are:

So, depending on what version you were using when you encountered these symptoms, it's possible they are already fixed by one of the above changes.

(In reply to Botond Ballo [:botond] from comment #7)

(In reply to Brinke Guthrie from comment #6)

any progress on this? It's been going on for ages.

There is a patch posted for this. I did a round of review on it today. It should be merged in the near future, and the fix will appear in Firefox 121 and possibly be backported to Firefox 120.

Note that this is just one of several recent fixes for these kinds of symptoms. Others are:

So, depending on what version you were using when you encountered these symptoms, it's possible they are already fixed by one of the above changes.

Wait- what's the current FF build then? It's not in the next revision?

(In reply to Brinke Guthrie from comment #8)

Wait- what's the current FF build then? It's not in the next revision?

Currently, 119 is released, 120 is in beta, and 121 is under active development.

When this bugfix is merged, it goes on the development ("nightly") branch, and by default will be released in 121, but there is a possibility of backporting a fix to the beta branch (in which case the fix would be released in 120). This fix may be a good candidate for backport since we're early in the release cycle, but that's a call for the patch author and release managers to make.

What site are you experiencing these symptoms on, and with what Firefox version?

Flags: needinfo?(brinkeguthrie)
Blocks: 1668136

(In reply to Botond Ballo [:botond] from comment #9)

(In reply to Brinke Guthrie from comment #8)

Wait- what's the current FF build then? It's not in the next revision?

Currently, 119 is released, 120 is in beta, and 121 is under active development.

When this bugfix is merged, it goes on the development ("nightly") branch, and by default will be released in 121, but there is a possibility of backporting a fix to the beta branch (in which case the fix would be released in 120). This fix may be a good candidate for backport since we're early in the release cycle, but that's a call for the patch author and release managers to make.

What site are you experiencing these symptoms on, and with what Firefox version?

Facebook has bounced like a ping pong ball on all FF versions for a couple of years now.

Flags: needinfo?(brinkeguthrie)

(In reply to Brinke Guthrie from comment #10)

Facebook has bounced like a ping pong ball on all FF versions for a couple of years now.

Ok, so the first thing I would suggest is trying the very recently released 119, which contains a fix for bug 1779404, which was specifically about Facebook.

Pushed by hikezoe.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b8229b3ad6bb
Dump some metrics in the failure messages in helper_scroll_anchoring_on_wheel.html. r=botond
https://hg.mozilla.org/integration/autoland/rev/7a509d3a2778
Handle scroll anchor adjustments as an absolute scroll position updates behind a pref. r=botond
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/42739 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
Upstream PR merged by moz-wptsync-bot

(In reply to Botond Ballo [:botond] from comment #11)

(In reply to Brinke Guthrie from comment #10)

Facebook has bounced like a ping pong ball on all FF versions for a couple of years now.

Ok, so the first thing I would suggest is trying the very recently released 119, which contains a fix for bug 1779404, which was specifically about Facebook.

Based on bug 1858022 comment 16, it looks like bug 1779404 did not fix the issue you were seeing.

It would be interesting to see if change made in this bug fixes it. When you get a chance, could you give the latest Nightly version (https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly) a try?

Flags: needinfo?(brinkeguthrie)

ah, don't do nightly on my Mac.

Flags: needinfo?(brinkeguthrie)

The patch landed in nightly and beta is affected.
:hiro, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox120 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(hikezoe.birchill)

I am not going to uplift this change since this change didn't fix the facebook jumply scrolling issue completely and it's unclear to me whether it's mitigated or not.

Flags: needinfo?(hikezoe.birchill)
Regressions: 1871760
Regressions: 1874551
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: