Skip to content

Commit a285f77

Browse files
DavMilaDavid Awogbemila
andauthored
[css-scroll-snap-2] Drop scroll-start and add issue to :snapped (#10505)
* [css-scroll-snap-2] Drop scroll-start and add issue to :snapped Towards resolving [6985](#6985 (comment)) this patch removes scroll-start from the spec and notes that :snapped is being replaced. * Remove "shorthand" for scroll-start-target * [css-scroll-snap-2] Put carousel example back into scroll-start spec --------- Co-authored-by: David Awogbemila <awogbemila@chromium.org>
1 parent e462f14 commit a285f77

File tree

1 file changed

+20
-154
lines changed

1 file changed

+20
-154
lines changed

css-scroll-snap-2/Overview.bs

Lines changed: 20 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ Introduction {#intro}
3939
<em>This is currently a delta spec over Scroll Snap 1.</em>
4040

4141
Scroll experiences don't always start at the beginning. Interactions with
42-
carousels, swipe controls, and listviews often start somewhere in the middle,
43-
and each require JavaScript to set this position on page load.
44-
By enabling CSS to specify this scroll start position,
45-
both users, page authors and browsers benefit.
42+
carousels, swipe controls, and listviews often intend to begin from some element
43+
which might not be positioned at the beginning of the scroll container.
44+
JavaScript is required to make the scroll container initially scrolled
45+
to that element. By enabling CSS to specify that an element should be
46+
initially scrolled to, both users, page authors and browsers benefit.
4647

47-
In addition to setting an initial scroll position,
48+
In addition to setting an initial scroll target,
4849
developers need insights and events into Scroll Snap.
4950
Events like which element is snapped on which axis,
5051
when the snap event is changing,
@@ -69,37 +70,27 @@ First Layout {#first-layout}
6970

7071
Motivating Examples {#examples}
7172
===============================
72-
7373
<div class="example">
74-
A carousel that starts in the middle:
75-
74+
A carousel that starts scrolled to the middle image:
7675
<pre class="lang-css">
7776
.carousel {
7877
overflow-inline: auto;
79-
scroll-start: center;
78+
}
79+
.carousel .origin {
80+
scroll-start-target: auto;
8081
}
8182
</pre>
8283

8384
<pre class="lang-html">
8485
&lt;div class="carousel">
8586
&lt;img src="img1.jpg">
8687
&lt;img src="img2.jpg">
87-
&lt;img src="img3.jpg">
88+
&lt;img src="img3.jpg" class="origin">
8889
&lt;img src="img4.jpg">
8990
&lt;img src="img5.jpg">
9091
&lt;/div>
9192
</pre>
92-
93-
<!-- <figure>
94-
<img src="images/element_snap_positions.png" alt="">
95-
96-
<figcaption>
97-
The layout of the scroll container’s contents in the example.
98-
The snapport is represented by the red rectangle, and the snap area is represented by the yellow rectangle. Since the scroll-snap-align is “center” in the inline (horizontal) axis, a snap position is established at each scroll position which aligns the X-center of the snapport (represented by a red dotted line) with the X-center of a snap area (represented by a yellow dotted line).
99-
</figcaption>
100-
</figure> -->
10193
</div>
102-
10394
<div class="example">
10495
A search bar is available when the user scrolls back to the top:
10596

@@ -137,93 +128,6 @@ Motivating Examples {#examples}
137128
Setting Where Scroll Starts {#properties-on-the-scroll-container}
138129
=================================================================
139130

140-
<!-- BIG TEXT: SCROLL START -->
141-
142-
The 'scroll-start' property {#scroll-start}
143-
-------------------------------------------
144-
145-
<pre class="propdef shorthand">
146-
Name: scroll-start
147-
Value: [ auto | start | end | center | left | right | top | bottom | <<length-percentage [0,∞]>> ]{1,2}
148-
</pre>
149-
150-
This property is a shorthand property that sets all of the scroll-start-* longhands in one declaration.
151-
The first value defines the scroll starting point in the block axis,
152-
the second sets it in the inline axis. If the second value is omitted, it defaults to ''scroll-start/start''. If ''scroll-start-target'' is set on any child, 'scroll-start' is not used, in favor of using the element as the offset.
153-
154-
Values are defined as follows:
155-
156-
<dl dfn-type=value dfn-for="scroll-start, scroll-start-x, scroll-start-y, scroll-start-block, scroll-start-inline">
157-
<dt><dfn>auto</dfn>
158-
<dd>
159-
...
160-
161-
<dt><dfn><<length-percentage [0,∞]>></dfn>
162-
<dd>
163-
...
164-
165-
Negative values are invalid.
166-
Values corresponding to a length greater than the width/height of the scrollport
167-
are valid,
168-
but clamped to the width/height of the scrollport.
169-
170-
<dt><dfn>start</dfn>
171-
<dt><dfn>center</dfn>
172-
<dt><dfn>end</dfn>
173-
<dd>
174-
Equivalent to ''0%'', ''50%'', and ''100%'', respectively.
175-
</dl>
176-
177-
<h4 id="display-none-behavior">
178-
Interaction with ''display: none'' and initial creation</h4>
179-
180-
Same behavior that animations follow with [[#first-layout]].
181-
182-
<h4 id="slow-page-load-behavior">
183-
Slow page loading or document streaming behavior</h4>
184-
185-
TODO
186-
187-
<h4 id="fragment-navigation-behavior">
188-
Interaction with "fragment navigation"</h4>
189-
190-
TODO
191-
192-
If the scrollport has a in-page '':target'' via a URL fragment or a previous scroll position, then 'scroll-start' is unused. Existing target logic should go unchanged. This makes 'scroll-start' a soft request in the scroll position resolution routines.
193-
194-
<h4 id="place-content-behavior">
195-
Interaction with 'place-content'</h4>
196-
197-
TODO
198-
199-
Note: While 'place-content' can make a scroller appear to start in the center
200-
or end, no browser supports it and it appears complicated to resolve.
201-
202-
<h4 id="find-in-page-behavior">
203-
Interaction with "find in page"</h4>
204-
205-
TODO
206-
207-
<h4 id="scroll-snap-container-behavior">
208-
Interaction with "scroll-snap" containers</h4>
209-
210-
This effectively will layout and start scroll at the snapped child, thus negating / cancelling 'scroll-start'. 'scroll-start' will only work if nothing else has effected the scroll position.
211-
212-
<h4 id="nested-scrollers">
213-
Nested scrollers with 'scroll-start'</h4>
214-
215-
Should follow patterns that scroll snap has set.
216-
217-
<h4 id="toggling-display-none">
218-
Interaction when 'display' is toggled</h4>
219-
220-
Same behavior that animations follow with [[#first-layout]].
221-
222-
<h4 id="rtl">
223-
Interaction with RTL and LTR</h4>
224-
225-
Logical properties are offered for length offsets that should be flow relative. Furthermore, the ''end'' and ''start'' keywords are always logical.
226-
227131
The 'scroll-start-target' property {#scroll-start-target}
228132
-------------------------------------------
229133

@@ -256,10 +160,9 @@ Initial scroll target</h4>
256160
</div>
257161

258162

259-
<h4 id="scroll-start-target-shorthand">
260-
The scroll-start-target shorthand</h4>
163+
<h4 id="scroll-start-target-propdef">scroll-start-target Property Definition</h4>
261164

262-
<pre class="propdef shorthand">
165+
<pre class="propdef">
263166
Name: scroll-start-target
264167
Value: [ none | auto ]
265168
Initial: ''none''
@@ -289,7 +192,7 @@ Interaction with 'place-content'</h4>
289192
<h4 id="scroll-start-fragment-navigation">
290193
Post-first layout arrivals</h4>
291194

292-
While the document is being [[html#updating-the-document|updated],
195+
While the document is being [[html#updating-the-document|updated]],
293196
a <a>scroll container's</a> [=initial scroll target=] might arrive
294197
after that <a>scroll container</a> has been laid out.
295198
If this happens,
@@ -313,6 +216,9 @@ Post-first layout arrivals</h4>
313216
Styling Snapped Items {#styling-snapped}
314217
=============================
315218

219+
Issue: The ':snapped' pseudo-class is being dropped in favor of a
220+
<a href="https://drafts.csswg.org/css-contain-4/scroll_state_explainer.html">container state query</a> approach.
221+
316222
The Snapped-element Pseudo-class: '':snapped'' {#snapped}
317223
-------------------------------------------------------
318224

@@ -650,47 +556,7 @@ when the scrolling operation ends.
650556
█████ ███▌ █▌ ▐▌ ███▌ █▌ █▌ █▌ █▌ █▌ ▐▌ ████▌
651557
-->
652558

653-
Appendix A: Longhands {#longhands}
654-
==================================
655-
656-
The physical and logical longhands (and their shorthands)
657-
interact as defined in [[!CSS-LOGICAL-1]].
658-
659-
Physical Longhands for 'scroll-start' {#scroll-start-longhands-physical}
660-
----------------------------------------------------------------------
661-
662-
<pre class="propdef">
663-
Name: scroll-start-x, scroll-start-y
664-
Value: auto | start | end | center | <<length-percentage [0,∞]>>
665-
Initial: auto
666-
Applies to: <a>scroll containers</a>
667-
Inherited: no
668-
Logical property group: scroll-start
669-
Percentages: relative to the corresponding axis of the scroll container’s scrollport
670-
Computed value: the keyword ''scroll-start/auto'' or a computed <<length-percentage>> value
671-
Animation type: by computed value type
672-
</pre>
673-
674-
...
675-
676-
Flow-relative Longhands for 'scroll-start' {#scroll-start-longhands-logical}
677-
--------------------------------------------------------------------------
678-
679-
<pre class="propdef">
680-
Name: scroll-start-inline, scroll-start-block
681-
Value: auto | start | end | center | <<length-percentage [0,∞]>>
682-
Initial: auto
683-
Applies to: <a>scroll containers</a>
684-
Inherited: no
685-
Logical property group: scroll-start
686-
Percentages: relative to the corresponding axis of the scroll container’s scrollport
687-
Computed value: the keyword ''scroll-start/auto'' or a computed <<length-percentage>> value
688-
Animation type: by computed value type
689-
</pre>
690-
691-
...
692-
693-
Appendix B: Event Handlers {#event-handlers}
559+
Appendix A: Event Handlers {#event-handlers}
694560
============================================================
695561

696562
ISSUE: This section should be moved to the HTML event handler
@@ -736,9 +602,9 @@ Extensions to the <code>GlobalEventHandlers</code> Interface Mixin {#interface-g
736602
Privacy Considerations {#privacy}
737603
======================
738604

739-
TODO
605+
The features in this spec have no known privacy implications.
740606

741607
Security Considerations {#security}
742608
=======================
743609

744-
TODO
610+
The features in this spec have no known security implications.

0 commit comments

Comments
 (0)