Bug 221240 - Applying scroll-snap-type resets scroll position to 0
Summary: Applying scroll-snap-type resets scroll position to 0
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 14
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-01 19:12 PST by Philip Fulgham
Modified: 2021-07-07 07:51 PDT (History)
4 users (show)

See Also:


Attachments
Minimal code reproduction (1.06 KB, text/html)
2021-02-01 19:12 PST, Philip Fulgham
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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!