Bug 210468

Summary: axis in scroll-snap-type should be required
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: ScrollingAssignee: Martin Robinson <mrobinson>
Status: RESOLVED FIXED    
Severity: Normal CC: esprehn+autocc, ews-watchlist, fred.wang, glenn, gyuyoung.kim, macpherson, majidvp, menard, mrobinson, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: BrowserCompat, InRadar, WebExposed
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Simon Fraser (smfr) 2020-04-13 17:07:10 PDT
We don't parse scroll-snap-type according to the spec:
https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-type

which means we're not compatible with Firefox and Chrome.
Comment 1 Radar WebKit Bug Importer 2020-04-13 17:11:00 PDT
<rdar://problem/61746766>
Comment 2 Simon Fraser (smfr) 2020-04-13 18:28:28 PDT
Actually we do parse it:

    auto firstValue = consumeIdent<CSSValueX, CSSValueY, CSSValueBlock, CSSValueInline, CSSValueBoth>(range);
    if (firstValue)
        secondValue = consumeIdent<CSSValueProximity, CSSValueMandatory>(range);
    else
        firstValue = consumeIdent<CSSValueNone, CSSValueProximity, CSSValueMandatory>(range);

but we treat the axis optional, when it should be required.
Comment 3 Martin Robinson 2020-10-15 06:34:11 PDT
Created attachment 411435 [details]
Patch
Comment 4 Martin Robinson 2020-10-15 07:26:35 PDT
*** Bug 187697 has been marked as a duplicate of this bug. ***
Comment 5 Simon Fraser (smfr) 2020-10-15 10:12:03 PDT
Comment on attachment 411435 [details]
Patch

I'm concerned about web compat here. Does the snapping on https://music.apple.com still work?
Comment 6 Majid Valipour 2020-10-15 17:58:13 PDT
FWIW, apple music scroll snapping works in Chrome which requires the new syntax.
Quick check on their home page showed they are using "scroll-snap-type: x mandatory".


Unfortunately chrome css data stats (https://chromestatus.com/metrics/css/popularity) do not tell you much about the value. But we can use it to compare usage of attributes that exclusively belong to the old syntax vs the new syntax: 


[exclusively old] <= 0.000001%
   scroll-snap-points-{x,y}, scroll-snap-coordinates, scroll-snap-destinations

[common in both] 2.090845%
  scroll-snap-types

[exclusively new] 2.090845%
  scroll-snap-align


This does suggest that old syntax is not being used much compared to the new one which could indicate that it is rare to have a single value that is not an axis as that is from old syntax and not valid in Chrome, Firefox, or Edge.

None of this is hard data on compat but hopefully helps.
Comment 7 Majid Valipour 2020-10-15 18:00:38 PDT
scroll-snap-align usage should be 2.119231%

so
[exclusively old] <= 0.000001%
   scroll-snap-points-{x,y}, scroll-snap-coordinates, scroll-snap-destinations

[common in both] 2.090845%
  scroll-snap-type

[exclusively new] 2.119231%
  scroll-snap-align
Comment 8 EWS 2020-10-19 02:24:53 PDT
Committed r268665: <https://trac.webkit.org/changeset/268665>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 411435 [details].