Bug 220056 - REGRESSION: Scroll snapping triggers body scroll
Summary: REGRESSION: Scroll snapping triggers body scroll
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: Safari Technology Preview
Hardware: Mac (Intel) macOS 10.15
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-12-21 07:49 PST by Bruno Stasse
Modified: 2020-12-23 10:52 PST (History)
6 users (show)

See Also:


Attachments
Test case (1.85 KB, text/html)
2020-12-21 07:49 PST, Bruno Stasse
no flags Details
Patch (8.57 KB, patch)
2020-12-22 14:32 PST, Simon Fraser (smfr)
wenson_hsieh: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Stasse 2020-12-21 07:49:16 PST
Created attachment 416602 [details]
Test case

Safari Technology Preview 117, on macOS 10.15.7

In a scroll container where scroll-snapping is enabled, a scroll gesture (followed by the snapping mechanism) causes the body to scroll as well in the same direction.

See the attachment for a test case, also available here: https://output.jsbin.com/qewoyuraya

Steps to reproduce:
1. Scroll vertically inside the yellow box with a trackpad

You will see the body scroll vertically as well as soon as the snapping takes place.

This is quite unexpected and problematic in some cases.
I know this could be prevented by setting the body to overflow: hidden, but it is not always possible or desired.
Note besides that scrolling programmatically the body in this case does not stop the scroll, as it should considering the revisions passed with STP 117.

This problem was not present before STP 116, so this might be a regression due to the changes made on scrolling and scroll-snapping in STP 117.
Possibly related to:
- https://bugs.webkit.org/show_bug.cgi?id=219923
- https://bugs.webkit.org/show_bug.cgi?id=219960
which also appeared in STP 117.
Comment 1 Smoley 2020-12-22 11:59:32 PST
Thanks for filing. I'm not sure about the regression status as I can reproduce this on Safari 13.1.3 as well as STP 117 (14.1).
Comment 2 Radar WebKit Bug Importer 2020-12-22 11:59:43 PST
<rdar://problem/72595482>
Comment 3 Bruno Stasse 2020-12-22 12:09:49 PST
Yes, that's right I can too. However, I'm pretty sure it was not the case in STP 115 (I don't know about 116, I didn't test it).
Comment 4 Simon Fraser (smfr) 2020-12-22 12:31:38 PST
Latching isn't working correctly; with scroll snap we fail to tell ScrollingTreeLatchingController that we've received events, so the latch times out.
Comment 5 Simon Fraser (smfr) 2020-12-22 13:33:02 PST
This might be:
    if (processWheelEventForScrollSnap(wheelEvent))
        return false; // FIXME: Why don't we report that we handled it?
Comment 6 Simon Fraser (smfr) 2020-12-22 14:32:26 PST
Created attachment 416694 [details]
Patch
Comment 7 Sam Weinig 2020-12-22 15:04:54 PST
Comment on attachment 416694 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416694&action=review

> Source/WebCore/platform/cocoa/ScrollController.h:172
>      bool processWheelEventForScrollSnap(const PlatformWheelEvent&);

Not for this change obviously, but maybe it's time to replace these boolean return values with something a bit more expressive.
Comment 8 Simon Fraser (smfr) 2020-12-22 15:06:44 PST
Yeah, I spent 5 minutes trying to think of an enum name and failed. We need this handled/unhandled enum more extensively.
Comment 9 Simon Fraser (smfr) 2020-12-23 10:52:50 PST
https://trac.webkit.org/r271072