Skip to content

Commit fc18e62

Browse files
committed
[css-align-3][css-overflow-3] Content alignment on scroll containers extends scrollable area #4957
It does not otherwise affect layout or scrolling mechanics.
1 parent c45d656 commit fc18e62

File tree

2 files changed

+47
-41
lines changed

2 files changed

+47
-41
lines changed

css-align-3/Overview.bs

+25-25
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ Content Distribution for Scroll Containers</h5>
897897
<h5 id=auto-safety-position>
898898
Self-Alignment for Absolutely Positioned Boxes</h5>
899899

900-
For [=absolutely positioned=] [=alignment subjects=]
900+
For [=absolutely positioned=] [=alignment subjects=]
901901
whose relevant [=self-alignment property=] is not ''justify-self/normal'',
902902
the default [=overflow alignment=] behavior is as follows:
903903

@@ -1171,30 +1171,24 @@ Content-Distribution Shorthand: the 'place-content' property</h3>
11711171
in which case it is defaulted to ''start''.
11721172

11731173
<h3 id="overflow-scroll-position">
1174-
Overflow and Scroll Positions</h3>
1174+
Alignment Overflow and Scroll Containers</h3>
11751175

11761176
When the <a>content-distribution properties</a> are set
11771177
on a <a>scroll container</a> with an overflowing <a>alignment subject</a>,
1178-
rather than shifting the layout positions of its content,
1179-
they instead change its <a>initial scroll position</a>
1180-
so that the initially-visible content
1181-
of the <a>scroll container</a>
1182-
satisfies the [[#alignment-values|expected alignment]]
1183-
of the <a>alignment subject</a> and <a>alignment container</a>.
1184-
However, the [[css-scroll-snap-2#scroll-initial-target-with-place-content|scroll-initial-target]]
1185-
property, when present, overrides the <a>content-distribution properties</a>
1186-
in determining the <a>initial scroll position</a>.
1187-
1188-
Note: The presence of scrollbars can change the size of the [=scroll container’s=] content box,
1189-
and thus the size of the [=alignment container=]
1190-
and/or [=alignment subject=].
1178+
they reduce the clipping of the [=negative scrollable overflow region=]
1179+
just enough to ensure that <a>alignment subject</a> can be scrolled
1180+
into its ''align-content/start''-aligned position.
11911181

11921182
<div class='example'>
11931183
For example,
11941184
if a scrollable flex container is set to ''justify-content: flex-end''
11951185
(or ''justify-content: flex-start'' with ''flex-flow: row-reverse''),
1196-
it will be initially displayed scrolled all the way to the main-end edge of its content,
1186+
its [=in-flow=] content will be initially positioned
1187+
to align the main-end edge of its content to the main-end edge of the flex container,
11971188
and its content will appear to overflow its main-start edge.
1189+
However, the viewer will be able to scroll <em>up</em>
1190+
to view the overflowing [=in-flow=] content,
1191+
just as if ''justify-content: flex-start'' had been specified.
11981192
</div>
11991193

12001194
<figure>
@@ -1204,17 +1198,16 @@ Overflow and Scroll Positions</h3>
12041198
</figcaption>
12051199
</figure>
12061200

1207-
None of this changes how scroll coordinates are assigned:
1208-
the origin is still where it would be in a ''align-content/start''-aligned container,
1209-
it just might be initially positioned outside the <a>scrollport</a>.
1210-
12111201
Note: The <a>alignment subject</a> is not necessarily
12121202
identical to the <a>scrollable overflow area</a>:
1213-
content overflowing the <a>alignment subject</a>,
1214-
such as an absolutely-positioned or out-of-flow element,
1215-
grows the <a>scrollable overflow area</a> but not the <a>alignment subject</a>,
1216-
thus an ''align-content/end''-aligned <a>scroll container</a>
1217-
might not be initially scrolled all the way to the bottom.
1203+
content overflowing the <a>alignment subject</a>--
1204+
such as an [=out-of-flow=] box--
1205+
grows the <a>scrollable overflow area</a> but not the <a>alignment subject</a>.
1206+
Thus an ''align-content/end''-aligned <a>scroll container</a>
1207+
might not be initially scrolled all the way to the bottom,
1208+
and positioned content can still be clipped
1209+
if it is further into the [=negative scrollable overflow region=]
1210+
than the [=in-flow=] content forming the [=alignment subject=].
12181211

12191212
<figure>
12201213
<img src="images/scroll-align-overflow.jpg" alt="">
@@ -1226,6 +1219,10 @@ Overflow and Scroll Positions</h3>
12261219
</figcaption>
12271220
</figure>
12281221

1222+
Note: The presence of scrollbars can change
1223+
the size of the [=scroll container’s=] [=content box=]--
1224+
and thus the size of the [=alignment container=]
1225+
and/or [=alignment subject=].
12291226

12301227
<h3 id="baseline-align-content">
12311228
Baseline Content-Alignment</h3>
@@ -2523,6 +2520,9 @@ Changes</h2>
25232520
<a href="https://github.com/w3c/csswg-drafts/issues/9960">Issue 9960</a>)
25242521
<li>Make all the ''space-*'' keywords fallback to ''safe'' overflow.
25252522
(<a href="https://github.com/w3c/csswg-drafts/issues/10154">Issue 10154</a>)
2523+
<li>Clearly define the interaction of overflowing [=content distribution=] and [=scroll containers=]
2524+
to not impact layout, but to only affect the extent of the [=scrollable overflow area=].
2525+
(<a href="https://github.com/w3c/csswg-drafts/issues/4957">Issue 4957</a>)
25262526
<li>Only apply the special margin-edge baseline rule for [=scroll container=] [=block containers=]
25272527
when 'baseline-source' is its [=initial value=].
25282528
(<a href="https://github.com/w3c/csswg-drafts/issues/8214">Issue 8214</a>)

css-overflow-3/Overview.bs

+22-16
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Scrollable Overflow</h3>
225225
The border boxes
226226
of all boxes for which it is the containing block
227227
and whose border boxes are positioned not wholly
228-
in the [=negative scrollable overflow region=],
228+
in the [=unreachable scrollable overflow region=],
229229
accounting for transforms by projecting each box onto
230230
the plane of the element that establishes its <a>3D rendering context</a>.
231231
[[!CSS3-TRANSFORMS]]
@@ -265,15 +265,16 @@ Scrollable Overflow</h3>
265265

266266
<li>
267267
Additional padding added
268-
to the [=end=]-side of the [=scrollable overflow rectangle=]
269-
as necessary to enable a scroll position
270-
that satisfies the requirements of ''place-content: end'' alignment.
268+
to the [=scrollable overflow rectangle=]
269+
as necessary to enable scroll positions
270+
that satisfy the requirements of both
271+
''place-content: start'' and ''place-content: end'' alignment.
271272

272273
Note: This padding represents,
273274
within the [=scrollable overflow rectangle=],
274275
the box’s own padding
275-
so that when its content is scrolled to the end,
276-
there is padding between the end-edge of its in-flow (or floated) content
276+
so that when its content is scrolled to its end,
277+
there is padding between the edge of its in-flow (or floated) content
277278
and the border edge of the box.
278279
It typically ends up being exactly the same size as the box's own padding,
279280
except in a few cases--
@@ -293,9 +294,13 @@ Scrollable Overflow</h3>
293294

294295
Additionally, due to Web-compatibility constraints
295296
(caused by authors exploiting legacy bugs to surreptitiously hide content from visual readers but not search engines and/or speech output),
296-
UAs must clip any content in the [=negative scrollable overflow region=]
297-
(thereby behaving as if they had no <a>scrollable overflow</a>
298-
on the wrong side of the [=scroll origin=]).
297+
UAs must clip any content in the [=unreachable scrollable overflow region=].
298+
299+
Note: The [=content-distribution properties=] can
300+
[[css-align-3#overflow-scroll-position|alter the unreachable scrollable overflow region]]
301+
to ensure that a [=scroll container=]’s [=alignment subject=]
302+
is reachable after alignment.
303+
[[CSS-ALIGN-3]]
299304

300305
<!--
301306
Considerations:
@@ -341,9 +346,9 @@ Scrolling Overflow</h3>
341346
is typically dependent on the [=scroll container=]’s [=writing mode=],
342347
and, unless otherwise specified,
343348
coincides with its [=scroll origin position=].
344-
However, the 'align-content' and 'justify-content' properties [[!CSS-ALIGN-3]] as well as the
345-
'scroll-initial-target' property [[!CSS-SCROLL-SNAP-2]] can be used to change the [=initial scroll position=],
346-
see [[css-align-3#overflow-scroll-position]].
349+
For example, 'scroll-initial-target' property
350+
can be used to change the [=initial scroll position=].
351+
[[!CSS-SCROLL-SNAP-2]]
347352

348353
A <dfn export>scroll position</dfn> is a particular alignment
349354
of the [=scrollable overflow rectangle=]
@@ -356,8 +361,10 @@ Scrolling Overflow</h3>
356361
Unless otherwise specified,
357362
it is the [=block-start=] [=inline-start=] corner of the [=scrollable overflow rectangle=].
358363
(For example, in a [=flex container=] it is the [=main-start=] [=cross-start=] corner.)
359-
The area beyond the [=scroll origin=] in either axis
360-
is considered the <dfn export>negative scrollable overflow region</dfn>:
364+
Unless otherwise adjusted
365+
(e.g. [[css-align-3#overflow-scroll-position|by content alignment]] [[css-align-3]]),
366+
the area beyond the [=scroll origin=] in either axis
367+
is considered the <dfn export>unreachable scrollable overflow region</dfn>:
361368
content rendered here is not accessible to the reader,
362369
see [[#scrollable]].
363370
A [=scroll container=] is said to be scrolled to its [=scroll origin=]
@@ -368,8 +375,7 @@ Scrolling Overflow</h3>
368375

369376
<div class="example">
370377
For example,
371-
the 'align-content' and 'justify-content' properties [[CSS-ALIGN-3]]
372-
and [=scroll snapping=] [[CSS-SCROLL-SNAP-1]]
378+
[=scroll snapping=] [[CSS-SCROLL-SNAP-1]]
373379
can change the [=initial scroll position=]
374380
away from the [=scroll origin position=].
375381
</div>

0 commit comments

Comments
 (0)