At the moment, using Webkit (WkWebView) on iOS, when the user sets the `scrollTop` property of a scrollable div, WebKit currently clears all running animations on that ScrollView (Which includes rubber-band / touch inertia animations). This makes it impossible to create a smoothly scrolling div, that adjusts the scroll position while the user swipes to scroll (The user will snap to the position with all momentum halting abruptly). It is also worth noting that all stock iOS & macOS native controls allow you to keep the momentum going when adjusting the scroll position. Chromium on Android preserves the momentum and continues the animation as if it was started from the new scroll position. It would make sense to preserve this when the user wants inertia / rubber-banding. The relevant code that is currently stopping the animation is: https://github.com/WebKit/WebKit/blob/main/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp#L306 Which on iOS, is calling the following API `_stopScrollingAndZoomingAnimations` on the UIScrollView: https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm#L337
<rdar://problem/107840440>
Is this change something worth investigating? I would contribute the time to fix this if so.
Yes, I think it is to match other browsers.
I have several use cases that this behavior is preventing, one of them being a lightweight implementation of virtual scrolling. A change would be very much welcome.