Commit 932dae1
committed
Polyfill onScrollEnd Event in Safari (#32427)
We added support for `onScrollEnd` in #26789 but it only works in Chrome
and Firefox. Safari still doesn't support `scrollend` and there's no
indication that they will anytime soon so this polyfills it.
While I don't particularly love our synthetic event system this tries to
stay within the realm of how our other polyfills work. This implements
all `onScrollEnd` events as a plugin.
The basic principle is to first feature detect the `onscrollend` DOM
property to see if there's native support and otherwise just use the
native event.
Then we listen to `scroll` events and set a timeout. If we don't get any
more scroll events before the timeout we fire `onScrollEnd`. Basically
debouncing it. If we're currently pressing down on touch or a mouse then
we wait until it is lifted such as if you're scrolling with a finger or
using the scrollbars on desktop but isn't currently moving.
If we do get any native events even though we're in polyfilling mode, we
use that as an indication to fire the `onScrollEnd` early.
Part of the motivation is that this becomes extra useful pair for
#32422. We also probably need
these events to coincide with other gesture related internals so you're
better off using our polyfill so they're synced.
DiffTrain build for [605a880](605a880)1 parent 001603f commit 932dae1
File tree
34 files changed
+126
-106
lines changed- compiled/facebook-www
34 files changed
+126
-106
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
1536 | | - | |
| 1536 | + | |
1537 | 1537 | | |
1538 | 1538 | | |
1539 | 1539 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
1536 | | - | |
| 1536 | + | |
1537 | 1537 | | |
1538 | 1538 | | |
1539 | 1539 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
648 | | - | |
| 648 | + | |
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
648 | | - | |
| 648 | + | |
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17349 | 17349 | | |
17350 | 17350 | | |
17351 | 17351 | | |
17352 | | - | |
| 17352 | + | |
17353 | 17353 | | |
17354 | 17354 | | |
17355 | | - | |
| 17355 | + | |
17356 | 17356 | | |
17357 | 17357 | | |
17358 | 17358 | | |
| |||
17386 | 17386 | | |
17387 | 17387 | | |
17388 | 17388 | | |
17389 | | - | |
| 17389 | + | |
17390 | 17390 | | |
17391 | 17391 | | |
17392 | 17392 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17121 | 17121 | | |
17122 | 17122 | | |
17123 | 17123 | | |
17124 | | - | |
| 17124 | + | |
17125 | 17125 | | |
17126 | 17126 | | |
17127 | | - | |
| 17127 | + | |
17128 | 17128 | | |
17129 | 17129 | | |
17130 | 17130 | | |
| |||
17158 | 17158 | | |
17159 | 17159 | | |
17160 | 17160 | | |
17161 | | - | |
| 17161 | + | |
17162 | 17162 | | |
17163 | 17163 | | |
17164 | 17164 | | |
| |||
0 commit comments