Closed Bug 1172171 Opened 9 years ago Closed 7 years ago

Add a chrome-only scrollend event

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox41 --- affected
firefox58 --- fixed

People

(Reporter: sfoster, Assigned: mconley)

References

Details

Attachments

(2 files)

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 :)
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)
Assignee: nobody → mstange
Flags: needinfo?(bugs)
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.
Blocks: 1403563
Summary: Proposal: scrollend event → Add a chrome-only scrollend event
Assignee: mstange → mconley
Status: NEW → ASSIGNED
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 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+
Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dbdc2cf84084
Add a chrome-only scrollend event. r=kats
https://hg.mozilla.org/mozilla-central/rev/dbdc2cf84084
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Depends on: 1421351
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: