Add a chrome-only scrollend event

RESOLVED FIXED in Firefox 58

Status

()

Core
Layout
RESOLVED FIXED
3 years ago
8 months ago

People

(Reporter: sfoster, Assigned: mconley)

Tracking

Trunk
mozilla58
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox41 affected, firefox58 fixed)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(2 attachments)

(Reporter)

Description

3 years ago
When smooth-scrolling there is currently no good way to determine that scrolling has ended. We can wait some number of milliseconds or frames and watch that scrollLeft/Top doesnt change and no further scroll events have been fired. It would be extremely useful to have an event analogous to transitionend and animationend that allowed an author to be notified when scrolling has stopped.
FWIW I think this is a good idea, particular with APZ scrolling where the scrolling is even more async than "main-thread async" scrolling.
(In reply to Sam Foster [:sfoster] from comment #0)
> When smooth-scrolling there is currently no good way to determine that
> scrolling has ended. We can wait some number of milliseconds or frames and
> watch that scrollLeft/Top doesnt change and no further scroll events have
> been fired. It would be extremely useful to have an event analogous to
> transitionend and animationend that allowed an author to be notified when
> scrolling has stopped.

+1

There's really no good way to do this on the content side currently.
Or least none that we know of :)

Comment 3

3 years ago
n?jet just to make sure that layout/rendering are aware of this request :)

This would be extremely useful, especially now we have CSS scroll snapping.
Flags: needinfo?(bugs)

Updated

3 years ago
Assignee: nobody → mstange
Flags: needinfo?(bugs)
Created attachment 8706986 [details]
MozReview Request: Bug 1172171 - If dom.event.scrollend.enabled is true, fire a scrollend event every time APZ stops scrolling or zooming.

Review commit: https://reviewboard.mozilla.org/r/30553/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/30553/
It's working pretty well for our use case!

(An APZ based UI, where we frequently call |.scrollTo({behavior: 'smooth'}))| and want to trigger something right after the scroll [1]).

One thing that I noted is that I always get a second scrollend event ~680ms after the first one. Wonder if it comes from our use of CSS-snapping...

[1] https://github.com/kite-project/hope/pull/28
Anything blocking here? :)
Flags: needinfo?(mstange)
I have a few high priority regressions to fix, so at the moment I don't have time to investigate why we're getting a second scrollend event in some cases.
Would you like me to land this, even in the preffed-off by default state, and even though we sometimes fire an extra event?
Flags: needinfo?(mstange)
(In reply to Markus Stange [:mstange] from comment #7)
> I have a few high priority regressions to fix, so at the moment I don't have
> time to investigate why we're getting a second scrollend event in some cases.
> Would you like me to land this, even in the preffed-off by default state,
> and even though we sometimes fire an extra event?

Yes :)
We're not exactly in a rush, but we can definitely move forward on the frontend side while leaving the "double event" issue to a follow up.
Comment hidden (mozreview-request)
Summary: Proposal: scrollend event → Add a chrome-only scrollend event
Assignee: mstange → mconley
Status: NEW → ASSIGNED
(Reporter)

Comment 10

8 months ago
The original request in Comment #0 came out of firefox OS and the need for a scrollend event in content (rather than or as well as in chrome). But if it takes a chrome-only implementation to move this forward and prove (or not) its value, I'm happy :)

Comment 11

8 months ago
mozreview-review
Comment on attachment 8927463 [details]
Bug 1172171 - Add a chrome-only scrollend event.

https://reviewboard.mozilla.org/r/198786/#review203874
Attachment #8927463 - Flags: review?(bugmail) → review+

Comment 12

8 months ago
Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dbdc2cf84084
Add a chrome-only scrollend event. r=kats

Comment 13

8 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/dbdc2cf84084
Status: ASSIGNED → RESOLVED
Last Resolved: 8 months ago
status-firefox58: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.