Bug 221240

Summary: Applying scroll-snap-type resets scroll position to 0
Product: WebKit Reporter: Philip Fulgham <webkitbugs>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: bfulgham, mrobinson, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: All   
OS: All   
Attachments:
Description Flags
Minimal code reproduction none

Description Philip Fulgham 2021-02-01 19:12:08 PST
Created attachment 418951 [details]
Minimal code reproduction

I've come across what I *believe* is a bug in Safari (both macOS and iOS) with the scroll-snap-type CSS property. If I apply a scroll-snap-type property using JavaScript to an element that didn't already have it, the element's scroll position resets to 0. This contrasts with Chromium, in which the element's scroll position just jumps to the nearest snap point, which seems to be the more logical behavior.

This may be related to bug #214232 in some way, but this issue seemed slightly different (as acknowledged by a comment on that bug) and easier to reproduce, so I thought maybe it should be filed separately. I've attached a minimal code reproduction. The seemingly bugged behavior occurs for me in Safari 13, 14, and TP.
Comment 1 Radar WebKit Bug Importer 2021-02-08 19:13:13 PST
<rdar://problem/74125149>
Comment 2 Martin Robinson 2021-07-07 07:51:29 PDT
As far as I can tell this is now working in the latest from the repository as well as the latest Safari Technology Preview. Some other fix must have corrected this error. I'm going to close this, but please reopen if you can still reproduce it. Thanks!