Closed Bug 1796690 Opened 2 years ago Closed 1 year ago

scrollintoview triggers a scrollend event event in parent element even if no scrolling needs to be done

Categories

(Core :: Panning and Zooming, defect)

defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- verified
firefox110 --- verified

People

(Reporter: dlrobertson, Assigned: dlrobertson)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

Steps to reproduce

  • Navigate to the attached page.
  • Watch the document scrollend count.

Expected results.

  • The document scrollend event listener should not be triggered from the initial setup scroll nor the scrollIntoView.

Actual results.

  • On scrollIntoView the documents scrollend listener is called.

Discussion

It appears that the AsyncSmoothMSDScrollCallback or AsyncScrollCallback is called after the scrollIntoView with a zero range, and we fire the scrollend event regardless of the range covered. This is could be the right thing to do in the case that the scroll frame was the caller of scrollIntoView, but it appears that we also call scrollIntoView on the parent elements of the caller.

Blocks: 1785102
Severity: -- → S3

Add simple test to trigger a scrollend due to a call to scrollIntoView.

Assignee: nobody → drobertson
Status: NEW → ASSIGNED

Interestingly, this spec change means that we shouldn't be firing scrollend events for scrolls that do not cause any scroll anyways. So just never firing a scrollend event for any scroll that scrolled over an empty range should fix this.

Attachment #9300027 - Attachment description: Bug 1796690: add tests for scrollend after scrollIntoView. r=botond,hiro → Bug 1796690 - Fire scrollend for scroll that updates scroll position. r=hiro,botond

Restore the scroll position before running each subtest in the scrollend event
handler content attributes tests.

Attachment #9301972 - Attachment description: Bug 1796690 - restore the scroll position before each subtest. r=hiro → Bug 1796690 - Restore the scroll position before each subtest. r=hiro
Pushed by drobertson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/887104a60dc4
Restore the scroll position before each subtest. r=hiro
https://hg.mozilla.org/integration/autoland/rev/d86f25e5b636
Fire scrollend for scroll that updates scroll position. r=hiro
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/36849 for changes under testing/web-platform/tests
Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5040c6736ee7
Mark scrollend-event-for-user-scroll.html subtest as intermittent on Android. a=test-only CLOSED TREE

Backed out for causing mochitest failures in browser/components/urlbar/tests/browser/browser_UrlbarInput_overflow.js

Backout link: https://hg.mozilla.org/integration/autoland/rev/af34ce4e5c1ad767a1916764496a5ebe14703e95

Push with failures

Failure log

FYI: also I backed out Cosmin's wpt fix

Failure log wpt

Flags: needinfo?(drobertson)
Upstream PR was closed without merging

Ah it does look like my fix does not take into account overscroll. I'll have to figure out a way around this.

Flags: needinfo?(drobertson)

There are two test cases stuck by Dan's change here, these cases, I wonder our mochitest harness supports IPv6 addresses? CCing :mak who is the author of the test cases.

Note that with D160156 we no longer fire scrollend events in cases where the scroll position is unchanged, in other words we've been firing scrollend events even if the scroll position is unchanged, and I suppose the test cases have been passing unintentionally because of the scrollend events?

Update the urlbar text overflow direction calculation after recent scrollend
changes do not result in scrollend events fired for scrolls that do not change
the scroll position.

Depends on D160156

(In reply to Hiroyuki Ikezoe (:hiro) from comment #10)

I wonder our mochitest harness supports IPv6 addresses? CCing :mak who is the author of the test cases.

The test is not actually causing visits or any network traffic, it's just checking how the urlbar input field reacts to the given string.

Attachment #9302951 - Attachment description: Bug 1796690 - update urlbar text overflow direction calculation. r=mak,hiro → Bug 1796690 - Update urlbar text overflow direction calculation. r=mak,hiro
Pushed by drobertson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/66ddf8488393
Restore the scroll position before each subtest. r=hiro
https://hg.mozilla.org/integration/autoland/rev/70903d77e4f0
Fire scrollend for scroll that updates scroll position. r=hiro
https://hg.mozilla.org/integration/autoland/rev/28f9e04d3500
Update urlbar text overflow direction calculation. r=mak

Backed out for causing mochitest failures on browser_primaryUI.js

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | browser/tools/mozscreenshots/primaryUI/browser_primaryUI.js | Unexpected exception in [ tabsInTitlebar, twoPinnedWithOverflow, maximized, onlyNavBar, noLWT, compactDensity ]: Timed out -
Flags: needinfo?(drobertson)
Upstream PR was closed without merging

Do not wait for scrollend after a scroll that will not trigger a change in scroll
position. A scrollend event will not be fired for a programatic scroll that will
not change the scroll position.

Depends on D161846

D161846 should fix the failing test.

Flags: needinfo?(drobertson)
Pushed by drobertson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/daafa9467f36
Restore the scroll position before each subtest. r=hiro
https://hg.mozilla.org/integration/autoland/rev/79b8fc96663e
Fire scrollend for scroll that updates scroll position. r=hiro
https://hg.mozilla.org/integration/autoland/rev/deb588549764
Update urlbar text overflow direction calculation. r=mak
https://hg.mozilla.org/integration/autoland/rev/9062c3b9febf
Use instant scrolls in test setup. r=dao
Upstream PR merged by moz-wptsync-bot
Regressions: 1803455
Flags: qe-verify+

I used two build before and after the fix on Win10x64:

  1. FF build 108.0a1(20221020215126) and
  2. Beta 109.0b1(20221212143511),
  • the only difference is that on Beta the "Scrollend Event Count: 18" number keeps rising if continue scrolling compared to Nightly were it remains at zero "Scrollend Event Count: 0". Is this the expected result before and after the fix? Thank you so much.
Flags: needinfo?(drobertson)

(In reply to Monica Chiorean from comment #21)

I used two build before and after the fix on Win10x64:

  1. FF build 108.0a1(20221020215126) and
  2. Beta 109.0b1(20221212143511),
  • the only difference is that on Beta the "Scrollend Event Count: 18" number keeps rising if continue scrolling compared to Nightly were it remains at zero "Scrollend Event Count: 0". Is this the expected result before and after the fix? Thank you so much.

Note that for 108 builds the scrollend event will not be enabled to fire to content by default. Ensure that the preference apz.scrollend-event.content.enabled is set to true before testing this bug (default true for 109 AFAIK). The key counter to watch is the Scrollend Event Count: in the Document section. For builds before this was landed, the value should be greater than 0, but for builds after this landed, the value should be 0.

The "real" answer is that scrollend events should only be fired when a scroll occurred. As a result, where the Scroll Event Count: is 0, the Scrollend Event Count: should also be 0.

Flags: needinfo?(drobertson)

I was able to get value '1' for "Scrollend Event Count: in the Document section", on a Win10x64 machine using FF build 108.0.1(20221215175817).
Verified as fixed on Win10x64/Mac 10.13/Ubuntu 20.04 using FF builds 109.0b5(20221220185745) and Nightly 110.0a1(20221220214632).

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: