Skip to content

Commit 3e31514

Browse files
committed
[css-align-3] Adjust abspos smart overflow alignment to handle anchor-center #12020
1 parent 1b85aac commit 3e31514

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

css-align-3/Overview.bs

+26-25
Original file line numberDiff line numberDiff line change
@@ -778,12 +778,12 @@ Distributed Alignment: the ''<content-distribution>/stretch'', ''space-between''
778778
<h3 id='overflow-values'>
779779
Overflow Alignment: the ''safe'' and ''unsafe'' keywords and scroll safety limits</h3>
780780

781-
When the <a>alignment subject</a> is larger than the <a>alignment container</a>,
782-
it will overflow.
783-
Some alignment modes, if honored in this situation,
784-
may cause data loss:
785-
for example, if the contents of a sidebar are centered,
786-
when they overflow they may send part of their boxes past the viewport's start edge,
781+
In some situations,
782+
aligning exactly as specified
783+
would cause the [=alignment subject=] to overflow its [=alignment container=],
784+
possibly causing data loss.
785+
For example, if the contents of a sidebar are unconditionally centered,
786+
items large enough to overflow it might extend beyond the viewport's start edge,
787787
which can't be scrolled to.
788788

789789
<div class='example'>
@@ -902,30 +902,31 @@ Self-Alignment for Absolutely Positioned Boxes</h5>
902902
the default [=overflow alignment=] behavior is as follows:
903903

904904
<div algorithm="default overflow self-alignment for abspos">
905-
1. Let the |default overflow rect| be the bounding rectangle
906-
of the [=alignment subject's=] [=inset-modified containing block=]
907-
and its [=original containing block=].
908-
2. If the [=alignment subject=] overflows its [=inset-modified containing block=]
909-
(its normal [=alignment container=]),
910-
but does not overflow |default overflow rect|
911-
align as specified (''unsafe'').
912-
3. If the <em>size</em> of the [=alignment subject=]
913-
fits within the |default overflow rect|,
914-
but its specified alignment would cause it to overflow the |default overflow rect|,
915-
it is instead shifted the minimum amount
916-
to stay within the |default overflow rect|
917-
while honoring the alignment as much as possible
918-
(i.e., flush with the edge of the [=original containing block=]
919-
it was trying to overflow over).
920-
4. If the size of the [=alignment subject=]
921-
overflows the |default overflow rect|,
922-
it is instead start-aligned within the |default overflow rect|
923-
(similar to ''safe'').
905+
1. If the [=alignment subject=] fits within the [=inset-modified containing block=],
906+
align as specified to the extent possible
907+
without overflowing the [=inset-modified containing block=].
908+
2. Otherwise,
909+
if the [=alignment subject=] fits within the |overflow limit rect|,
910+
align the [=alignment subject=] such that
911+
it fully covers the [=inset-modified containing block=]
912+
and is otherwise aligned as specified to the extent possible
913+
without overflowing the |overflow limit rect|.
914+
3. Otherwise,
915+
start-align the [=alignment subject=] within the |overflow limit rect|
916+
(similar to ''align-self/safe'').
917+
918+
For this purpose, the |overflow limit rect| is the bounding rectangle
919+
of the [=alignment subject's=] [=inset-modified containing block=]
920+
and its [=original containing block=].
924921
</div>
925922

926923
(For [=absolutely-positioned=] [=alignment subjects=] that fail the above condition,
927924
see [[#auto-safety-default]].)
928925

926+
Note: These rules constrain the position of the box to minimize overflow
927+
while honoring the specified alignment insofar as possible,
928+
and ensuring continuous behavior as the sizes of the boxes change.
929+
929930
<h5 id=auto-safety-default>
930931
All Other Alignment</h5>
931932

0 commit comments

Comments
 (0)