Skip to content

Commit c2c22ef

Browse files
author
David Awogbemila
committed
[css-scroll-snap-2] Drop scroll-start and add issue to :snapped
Towards resolving [6985](w3c#6985 (comment)) this patch removes scroll-start from the spec and notes that :snapped is being replaced.
1 parent e4ba280 commit c2c22ef

File tree

1 file changed

+13
-166
lines changed

1 file changed

+13
-166
lines changed

css-scroll-snap-2/Overview.bs

Lines changed: 13 additions & 166 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,
@@ -70,36 +71,6 @@ First Layout {#first-layout}
7071
Motivating Examples {#examples}
7172
===============================
7273

73-
<div class="example">
74-
A carousel that starts in the middle:
75-
76-
<pre class="lang-css">
77-
.carousel {
78-
overflow-inline: auto;
79-
scroll-start: center;
80-
}
81-
</pre>
82-
83-
<pre class="lang-html">
84-
&lt;div class="carousel">
85-
&lt;img src="img1.jpg">
86-
&lt;img src="img2.jpg">
87-
&lt;img src="img3.jpg">
88-
&lt;img src="img4.jpg">
89-
&lt;img src="img5.jpg">
90-
&lt;/div>
91-
</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> -->
101-
</div>
102-
10374
<div class="example">
10475
A search bar is available when the user scrolls back to the top:
10576

@@ -137,93 +108,6 @@ Motivating Examples {#examples}
137108
Setting Where Scroll Starts {#properties-on-the-scroll-container}
138109
=================================================================
139110

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-
227111
The 'scroll-start-target' property {#scroll-start-target}
228112
-------------------------------------------
229113

@@ -289,7 +173,7 @@ Interaction with 'place-content'</h4>
289173
<h4 id="scroll-start-fragment-navigation">
290174
Post-first layout arrivals</h4>
291175

292-
While the document is being [[html#updating-the-document|updated],
176+
While the document is being [[html#updating-the-document|updated]],
293177
a <a>scroll container's</a> [=initial scroll target=] might arrive
294178
after that <a>scroll container</a> has been laid out.
295179
If this happens,
@@ -313,6 +197,9 @@ Post-first layout arrivals</h4>
313197
Styling Snapped Items {#styling-snapped}
314198
=============================
315199

200+
Issue: The ':snapped' pseudo-class is being dropped in favor of a
201+
<a href="https://drafts.csswg.org/css-contain-4/scroll_state_explainer.html">container state query</a> approach.
202+
316203
The Snapped-element Pseudo-class: '':snapped'' {#snapped}
317204
-------------------------------------------------------
318205

@@ -650,47 +537,7 @@ when the scrolling operation ends.
650537
█████ ███▌ █▌ ▐▌ ███▌ █▌ █▌ █▌ █▌ █▌ ▐▌ ████▌
651538
-->
652539

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}
540+
Appendix A: Event Handlers {#event-handlers}
694541
============================================================
695542

696543
ISSUE: This section should be moved to the HTML event handler
@@ -736,9 +583,9 @@ Extensions to the <code>GlobalEventHandlers</code> Interface Mixin {#interface-g
736583
Privacy Considerations {#privacy}
737584
======================
738585

739-
TODO
586+
The features in this spec have no known privacy implications.
740587

741588
Security Considerations {#security}
742589
=======================
743590

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

0 commit comments

Comments
 (0)