Skip to content

Commit cf4096f

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 e64b3e9 commit cf4096f

File tree

2 files changed

+41
-37
lines changed

2 files changed

+41
-37
lines changed

css-align-3/Overview.bs

+23-21
Original file line numberDiff line numberDiff line change
@@ -1106,27 +1106,24 @@ Content-Distribution Shorthand: the 'place-content' property</h3>
11061106
in which case it is defaulted to ''start''.
11071107

11081108
<h3 id="overflow-scroll-position">
1109-
Overflow and Scroll Positions</h3>
1109+
Alignment Overflow and Scroll Containers</h3>
11101110

11111111
When the <a>content-distribution properties</a> are set
11121112
on a <a>scroll container</a> with an overflowing <a>alignment subject</a>,
1113-
rather than shifting the layout positions of its content,
1114-
they instead change its <a>initial scroll position</a>
1115-
so that the initially-visible content
1116-
of the <a>scroll container</a>
1117-
satisfies the [[#alignment-values|expected alignment]]
1118-
of the <a>alignment subject</a> and <a>alignment container</a>.
1119-
1120-
Note: The presence of scrollbars can change the size of the [=scroll container’s=] content box,
1121-
and thus the size of the [=alignment container=]
1122-
and/or [=alignment subject=].
1113+
they reduce the clipping of the [=negative scrollable overflow region=]
1114+
just enough to ensure that <a>alignment subject</a> can be scrolled
1115+
into its ''align-content/start''-aligned position.
11231116

11241117
<div class='example'>
11251118
For example,
11261119
if a scrollable flex container is set to ''justify-content: flex-end''
11271120
(or ''justify-content: flex-start'' with ''flex-flow: row-reverse''),
1128-
it will be initially displayed scrolled all the way to the main-end edge of its content,
1121+
its [=in-flow=] content will be initially positioned
1122+
to align the main-end edge of its content to the main-end edge of the flex container,
11291123
and its content will appear to overflow its main-start edge.
1124+
However, the viewer will be able to scroll <em>up</em>
1125+
to view the overflowing [=in-flow=] content,
1126+
just as if ''justify-content: flex-start'' had been specified.
11301127
</div>
11311128

11321129
<figure>
@@ -1136,17 +1133,16 @@ Overflow and Scroll Positions</h3>
11361133
</figcaption>
11371134
</figure>
11381135

1139-
None of this changes how scroll coordinates are assigned:
1140-
the origin is still where it would be in a ''align-content/start''-aligned container,
1141-
it just might be initially positioned outside the <a>scrollport</a>.
1142-
11431136
Note: The <a>alignment subject</a> is not necessarily
11441137
identical to the <a>scrollable overflow area</a>:
1145-
content overflowing the <a>alignment subject</a>,
1146-
such as an absolutely-positioned or out-of-flow element,
1147-
grows the <a>scrollable overflow area</a> but not the <a>alignment subject</a>,
1148-
thus an ''align-content/end''-aligned <a>scroll container</a>
1149-
might not be initially scrolled all the way to the bottom.
1138+
content overflowing the <a>alignment subject</a>--
1139+
such as an [=out-of-flow=] box--
1140+
grows the <a>scrollable overflow area</a> but not the <a>alignment subject</a>.
1141+
Thus an ''align-content/end''-aligned <a>scroll container</a>
1142+
might not be initially scrolled all the way to the bottom,
1143+
and positioned content can still be clipped
1144+
if it is further into the [=negative scrollable overflow region=]
1145+
than the [=in-flow=] content forming the [=alignment subject=].
11501146

11511147
<figure>
11521148
<img src="images/scroll-align-overflow.jpg" alt="">
@@ -1158,6 +1154,9 @@ Overflow and Scroll Positions</h3>
11581154
</figcaption>
11591155
</figure>
11601156

1157+
Note: The presence of scrollbars can change the size of the [=scroll container’s=] content box,
1158+
and thus the size of the [=alignment container=]
1159+
and/or [=alignment subject=].
11611160

11621161
<h3 id="baseline-align-content">
11631162
Baseline Content-Alignment</h3>
@@ -2463,6 +2462,9 @@ Changes</h2>
24632462
(<a href="https://github.com/w3c/csswg-drafts/issues/8214">Issue 8214</a>)
24642463
<li>Made [=block containers=] default to ''safe'' alignment.
24652464
(<a href="https://github.com/w3c/csswg-drafts/issues/8992">Issue 8992</a>)
2465+
<li>Clearly define the interaction of overflowing [=content distribution=] and [=scroll containers=]
2466+
to not impact layout, but to only affect the extent of the [=scrollable overflow area=].
2467+
(<a href="https://github.com/w3c/csswg-drafts/issues/4957">Issue 4957</a>)
24662468
</ul>
24672469

24682470
Changes since the <a href="https://www.w3.org/TR/2021/WD-css-align-3-20211224/">24 December 2021 Working Draft</a> include:

css-overflow-3/Overview.bs

+18-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:
@@ -340,9 +345,6 @@ Scrolling Overflow</h3>
340345
is typically dependent on the [=scroll container=]’s [=writing mode=],
341346
and, unless otherwise specified,
342347
coincides with its [=scroll origin position=].
343-
However, the 'align-content' and 'justify-content' properties [[!CSS-ALIGN-3]]
344-
can be used to change the [=initial scroll position=],
345-
see [[css-align-3#overflow-scroll-position]].
346348

347349
A <dfn export>scroll position</dfn> is a particular alignment
348350
of the [=scrollable overflow rectangle=]
@@ -355,8 +357,9 @@ Scrolling Overflow</h3>
355357
Unless otherwise specified,
356358
it is the [=block-start=] [=inline-start=] corner of the [=scrollable overflow rectangle=].
357359
(For example, in a [=flex container=] it is the [=main-start=] [=cross-start=] corner.)
358-
The area beyond the [=scroll origin=] in either axis
359-
is considered the <dfn export>negative scrollable overflow region</dfn>:
360+
Unless otherwise adjusted (e.g. [[css-align-3#overflow-scroll-position|by content alignment]]),
361+
the area beyond the [=scroll origin=] in either axis
362+
is considered the <dfn export>unreachable scrollable overflow region</dfn>:
360363
content rendered here is not accessible to the reader,
361364
see [[#scrollable]].
362365
A [=scroll container=] is said to be scrolled to its [=scroll origin=]
@@ -367,8 +370,7 @@ Scrolling Overflow</h3>
367370

368371
<div class="example">
369372
For example,
370-
the 'align-content' and 'justify-content' properties [[CSS-ALIGN-3]]
371-
and [=scroll snapping=] [[CSS-SCROLL-SNAP-1]]
373+
[=scroll snapping=] [[CSS-SCROLL-SNAP-1]]
372374
can change the [=initial scroll position=]
373375
away from the [=scroll origin position=].
374376
</div>

0 commit comments

Comments
 (0)