@@ -291,7 +291,7 @@ Animation type: discrete
291
291
The 'anchor-default' property defines the <dfn>default anchor specifier</dfn>
292
292
for all [=anchor functions=] on the element,
293
293
allowing multiple elements to use the same set of [=anchor functions=]
294
- (and [=position fallback lists=] !)
294
+ (and [=position options lists=] !)
295
295
while changing which [=anchor element=] each is referring to.
296
296
297
297
The [=target anchor element=] selected by the [=default anchor specifier=]
@@ -853,7 +853,7 @@ we define:
853
853
or |query el|'s used [=self-alignment property=] value
854
854
in the axis is ''anchor-center'' .
855
855
856
- Note: If |query el| has a [=position fallback list=] ,
856
+ Note: If |query el| has a [=position options list=] ,
857
857
then whether it [=needs scroll adjustment=] in an axis
858
858
is also affected by the applied fallback style.
859
859
@@ -985,17 +985,18 @@ If no fallback value is specified,
985
985
it resolves to ''0px'' .
986
986
987
987
988
- <!--
989
- ████████ ███ ██ ██ ████████ ███ ██████ ██ ██
990
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
991
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
992
- ██████ ██ ██ ██ ██ ████████ ██ ██ ██ █████
993
- ██ █████████ ██ ██ ██ ██ █████████ ██ ██ ██
994
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
995
- ██ ██ ██ ████████ ████████ ████████ ██ ██ ██████ ██ ██
988
+ <!-- Big Text: fallback
989
+
990
+ █████▌ ███▌ █▌ █▌ ████▌ ███▌ ███▌ █▌ █▌
991
+ █▌ ▐█ ▐█ █▌ █▌ █▌ █▌ ▐█ ▐█ █▌ █▌ █▌ █▌
992
+ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌█▌
993
+ ████ █▌ █▌ █▌ █▌ █████ █▌ █▌ █▌ ██
994
+ █▌ █████▌ █▌ █▌ █▌ █▌ █████▌ █▌ █▌█▌
995
+ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌ █▌
996
+ █▌ █▌ █▌ █████ █████ ████▌ █▌ █▌ ███▌ █▌ █▌
996
997
-->
997
998
998
- Fallback Sizing/Positioning {#fallback}
999
+ Overflow Management {#fallback}
999
1000
===========================
1000
1001
1001
1002
Anchor positioning,
@@ -1007,95 +1008,225 @@ so positioning an element in any particular fashion
1007
1008
might result in the positioned element overflowing its [=containing block=]
1008
1009
or being positioned partially off screen.
1009
1010
1010
- To ameliorate this, an [=absolutely positioned=] element
1011
+ <s> To ameliorate this, an [=absolutely positioned=] element
1011
1012
can use the 'position-fallback' property
1012
1013
to refer to a ''@position-fallback'' block,
1013
1014
giving a list of possible style rules to try out.
1014
1015
Each is applied to the element, one by one,
1015
1016
and the first that doesn't cause the element
1016
1017
to overflow its [=containing block=]
1017
- is taken as the winner.
1018
+ is taken as the winner.</s>
1018
1019
1019
- The 'position-fallback' Property {#fallback-property }
1020
+ Giving Fallback Options: the 'position-try-options' property {#position-try-options }
1020
1021
--------------------------------
1021
1022
1022
1023
<pre class=propdef>
1023
- Name : position-fallback
1024
- Value : none | <<dashed-ident>>
1024
+ Name : position-try-options
1025
+ Value : none | [ <<dashed-ident>> | <<try-tactic>> ]#
1025
1026
Initial : none
1026
1027
Inherited : no
1027
1028
Applies to : [=absolutely-positioned=] elements
1028
1029
Animation type : discrete
1029
1030
</pre>
1030
1031
1032
+ This property provides a list of alternate positioning styles
1033
+ to try when the [=absolutely positioned box=]
1034
+ overflows its [=inset-modified containing block=] .
1035
+ This <dfn export>position options list</dfn>
1036
+ initially contains the element's own computed style.
1037
+
1038
+ Each comma-separated entry in the list is a separate option:
1039
+ either the name of a ''@position-try'' block,
1040
+ or a <<try-tactic>> representing an automatic transformation of the element's existing computed style.
1041
+
1031
1042
Values have the following meanings:
1032
1043
1033
- <dl dfn-type=value dfn-for=position-fallback >
1044
+ <dl dfn-type=value dfn-for=position-try-options >
1034
1045
: <dfn>none</dfn>
1035
- :: The property has no effect;
1036
- the element does not use a [=position fallback list=] .
1046
+ ::
1047
+ The property has no effect;
1048
+ the only entry in the [=position options list=]
1049
+ is the element's computed style.
1037
1050
1038
1051
: <dfn><<dashed-ident>></dfn>
1039
- :: If there is a ''@position-fallback'' rule
1040
- with a name matching the specified ident,
1041
- then the element uses that [=position fallback list=] .
1052
+ ::
1053
+ If there is a ''@position-try'' rule
1054
+ with the given name,
1055
+ its associated [=position option=]
1056
+ is added to the [=position options list=] .
1042
1057
1043
1058
Otherwise,
1044
1059
this value has no effect.
1060
+
1061
+ : <dfn><<try-tactic>></dfn>
1062
+ ::
1063
+ Automatically creates a [=position option=]
1064
+ from the element's computed style,
1065
+ by swapping the
1066
+ [=margin property|margin=] ,
1067
+ [=sizing property|sizing=] ,
1068
+ [=inset property|inset=] ,
1069
+ and [=self-alignment property|self-alignment=] property values
1070
+ among the element's sides,
1071
+ and adds it to the [=position options list=] .
1072
+
1073
+ <pre class=prod>
1074
+ <dfn type><<try-tactic>></dfn> = flip-block || flip-inline || flip-start
1075
+ </pre>
1076
+
1077
+ : <dfn>flip-block</dfn>
1078
+ ::
1079
+ swaps the values in the [=block axis=]
1080
+ (between, for example, 'margin-block-start' and 'margin-block-end' ),
1081
+ essentially mirroring across an [=inline-axis=] line.
1082
+
1083
+ : <dfn>flip-inline</dfn>
1084
+ ::
1085
+ swaps the values in the [=inline axis=] ,
1086
+ essentially mirroring across a [=block-axis=] line.
1087
+
1088
+ : <dfn>flip-start</dfn>
1089
+ ::
1090
+ swaps the values of the [=start=] properties with each other,
1091
+ and the [=end=] properties with each other
1092
+ (between, for example,
1093
+ 'margin-block-start' and 'margin-inline-start' ),
1094
+ essentially mirroring across a diagonal drawn
1095
+ from the [=block-start|start=] -[=inline-start|start=] corner
1096
+ to the [=block-end|end=] -[=inline-end|end=] corner.
1097
+
1098
+ If multiple keywords are given,
1099
+ the transformations are composed in order
1100
+ to produce a single [=position option=] .
1101
+
1102
+ Issue: Define how the values themselves are changed upon flipping:
1103
+ anchor(top) becomes anchor(bottom);
1104
+ start becomes end;
1105
+ etc.
1106
+ </dl>
1107
+
1108
+
1109
+ Determining Fallback Order: the 'position-try-order' property {#position-try-order-property}
1110
+ ----------------------------------
1111
+
1112
+ <pre class=propdef>
1113
+ Name : position-try-order
1114
+ Value : normal | <<try-size>>
1115
+ Initial : normal
1116
+ Applies to : [=absolutely positioned elements=]
1117
+ Inherited : no
1118
+ Animation Type : discrete
1119
+ </pre>
1120
+
1121
+ This property specifies the order in which
1122
+ the [=position options list=] will be tried.
1123
+
1124
+ <pre class=prod>
1125
+ <dfn type><<try-size>></dfn> = most-width | most-height | most-block-size | most-inline-size
1126
+ </pre>
1127
+
1128
+ <dl dfn-type=value dfn-for=position-try-order>
1129
+ : <dfn>normal</dfn>
1130
+ ::
1131
+ Try the [=position options=]
1132
+ in the order specified by 'position-try-options' .
1133
+
1134
+ : <dfn>most-width</dfn>
1135
+ : <dfn>most-height</dfn>
1136
+ : <dfn>most-block-size</dfn>
1137
+ : <dfn>most-inline-size</dfn>
1138
+ ::
1139
+ Stable sort the [=position options list=]
1140
+ in order of greatest to least
1141
+ [=inset-modified containing block=] size
1142
+ in the matching axis.
1045
1143
</dl>
1046
1144
1047
- The ''@position-fallback'' Rule {#fallback-rule}
1145
+ Final Fallback Strategy: the 'position-try-final' property {#position-try-final-property}
1146
+ ----------------------
1147
+
1148
+ <pre class=propdef>
1149
+ Name : position-try-final
1150
+ Value : [ always? && [ first | <<try-size>> ] ] | hide
1151
+ Initial : first
1152
+ Applies to : [=absolutely positioned elements=]
1153
+ Inherited : no
1154
+ Animation Type : discrete
1155
+ </pre>
1156
+
1157
+ When all options in the [=position options list=]
1158
+ would result in the element overflowing its [=inset-modified containing block=] ,
1159
+ this property determines which [=position option=] to use.
1160
+
1161
+ <dl dfn-type=value dfn-for=position-try-final>
1162
+ : <dfn>first</dfn>
1163
+ ::
1164
+ Use the first option in the [=position options list=]
1165
+ (after sorting by 'position-try-order' ).
1166
+
1167
+ : <dfn lt="<try-size> | most-width | most-height | most-block-size | most-inline-size"><<try-size>></dfn>
1168
+ ::
1169
+ Stable sort the [=position options list=] as if this was the specified 'position-try-order' ,
1170
+ then use the first option.
1171
+
1172
+ : <dfn>always</dfn>
1173
+ ::
1174
+ If this keyword is <em> not</em> specified,
1175
+ and this box has previously been laid out
1176
+ with a [=position option=]
1177
+ that didn't result in overflow,
1178
+ use that option.
1179
+
1180
+ : <dfn>hide</dfn>
1181
+ ::
1182
+ Use the first option (as for ''first'' ),
1183
+ but also hide the box such that it (and all of its contents)
1184
+ are invisible (like ''visibility: hidden'' )
1185
+ and do not contribute to [=scrollable overflow=] .
1186
+ </dl>
1187
+
1188
+
1189
+ The ''@position-try'' Rule {#fallback-rule}
1048
1190
-------------------------------
1049
1191
1050
- The <dfn>@position-fallback </dfn> rule
1051
- defines a [= position fallback list=]
1192
+ The <dfn>@position-try </dfn> rule
1193
+ defines a <dfn> position option</dfn>
1052
1194
with a given name,
1053
1195
specifying one or more sets of positioning properties
1054
- inside of <dfn>@try</dfn> blocks
1055
- that will be applied to an element,
1056
- with each successive one serving as fallback
1057
- if the previous would cause the element
1058
- to partially or fully overflow its [=containing block=] .
1196
+ that will be applied to an element
1197
+ via 'position-try-options' ,
1059
1198
1060
- The grammar of the ''@position-fallback '' rule is:
1199
+ The syntax of the ''@position-try '' rule is:
1061
1200
1062
1201
<pre class=prod>
1063
- @position-fallback <<dashed-ident>> {
1064
- <<rule -list>>
1202
+ @position-try <<dashed-ident>> {
1203
+ <<declaration -list>>
1065
1204
}
1066
-
1067
- @try { <<declaration-list>> }
1068
1205
</pre>
1069
1206
1070
- The ''@position-fallback'' rule only accepts ''@try'' rules.
1071
1207
The <<dashed-ident>> specified in the prelude
1072
1208
is the rule's name.
1073
- If multiple ''@position-fallback '' rules are declared with the same name,
1209
+ If multiple ''@position-try '' rules are declared with the same name,
1074
1210
the last one in document order "wins".
1075
1211
1076
- The ''@try'' rule only <dfn lt="accepted @try properties">accepts</dfn>
1212
+ Issue: Or should they cascade together?
1213
+
1214
+ The ''@position-try'' rule only <dfn lt="accepted @position-try properties">accepts</dfn>
1077
1215
the following [=properties=] :
1078
1216
1079
1217
* [=inset properties=]
1080
1218
* [=margin properties=]
1081
- * [=border properties=]
1082
- * [=padding properties=]
1083
1219
* [=sizing properties=]
1084
- * [=box alignment properties=]
1220
+ * [=self- alignment properties=]
1085
1221
1086
- Issue: What exactly are the constraints that determine what's allowed here?
1222
+ Issue(#9195) : What exactly are the constraints that determine what's allowed here?
1087
1223
Current list is based off of what's reasonable
1088
1224
from Chrome's experimental impl.
1089
1225
We can make a CQ that keys off of which fallback was used
1090
1226
to allow more general styling,
1091
1227
at least for descendants.
1092
1228
1093
- The ''@try'' rules inside a ''@position-fallback''
1094
- specify a <dfn>position fallback list</dfn> ,
1095
- where each entry consists of the properties specified by each ''@try'' ,
1096
- in order.
1097
-
1098
- Issue: Would be useful to be able to detect
1229
+ Issue(#7758): Would be useful to be able to detect
1099
1230
when your anchor(s) are fully off-screen
1100
1231
and suppress your display entirely.
1101
1232
For example, tooltips living outside the scroller
@@ -1113,9 +1244,9 @@ and specify each element's anchor in 'anchor-default' instead.
1113
1244
Note: The most common types of fallback positioning
1114
1245
(putting the positioned element on one side of the anchor normally,
1115
1246
but flipping to the opposite side if needed)
1116
- can be done automatically,
1117
- without using ''@ position-fallback'' at all ,
1118
- by using TODO FILL ME IN WITH NEW DETAILS .
1247
+ can be done automatically
1248
+ with keywords in ' position-try-options' ,
1249
+ without using ''@position-try'' at all .
1119
1250
1120
1251
Applying Stronger Fallback Bounds: the 'position-fallback-bounds' property {#fallback-bounds}
1121
1252
--------------------------------------------------------------------------
@@ -1156,7 +1287,7 @@ Animation type: discrete
1156
1287
: <dfn>normal</dfn>
1157
1288
:: The element uses its normal (scroll-adjusted, inset-modified) containing block
1158
1289
to determine if it's overflowing
1159
- for the purpose of selecting a [=position fallback list=] entry.
1290
+ for the purpose of selecting a [=position options list=] entry.
1160
1291
1161
1292
: <<dashed-ident>>
1162
1293
::
@@ -1178,7 +1309,7 @@ Animation type: discrete
1178
1309
Applying Position Fallback {#fallback-apply}
1179
1310
--------------------------
1180
1311
1181
- When an element uses a [=position fallback list=] ,
1312
+ When an element uses a [=position options list=] ,
1182
1313
it selects one entry from the list
1183
1314
as defined below,
1184
1315
and applies those properties to itself as [=used values=] .
@@ -1203,9 +1334,9 @@ to trigger automatic "animation" of the fallback'd properties.
1203
1334
1204
1335
1. Let |base styles| be the current used styles of |el|.
1205
1336
1206
- 2. [=list/For each=] |fallback styles| in the [=position fallback list=] :
1337
+ 2. [=list/For each=] |fallback styles| in the [=position options list=] :
1207
1338
1208
- 1. Apply the values of the [=accepted @try properties=]
1339
+ 1. Apply the values of the [=accepted @position- try properties=]
1209
1340
in |fallback styles| to |el|,
1210
1341
overriding the corresponding properties in |base styles|.
1211
1342
@@ -1239,7 +1370,7 @@ to trigger automatic "animation" of the fallback'd properties.
1239
1370
1240
1371
3. If the previous step finished without selecting a set of styles,
1241
1372
use the |adjusted styles|
1242
- corresponding to the final entry in the [=position fallback list=] .
1373
+ corresponding to the final entry in the [=position options list=] .
1243
1374
1244
1375
Note: Descendants overflowing |el|
1245
1376
don't affect this calculation,
@@ -1250,7 +1381,7 @@ The styles returned by [=determining the position fallback styles=]
1250
1381
are taken as the final values for the specified properties.
1251
1382
1252
1383
Implementations may choose to impose an implementation-defined limit
1253
- on the length of [=position fallback lists=] ,
1384
+ on the length of [=position options lists=] ,
1254
1385
to limit the amount of excess layout work that may be required.
1255
1386
This limit must be <em> at least</em> five.
1256
1387
0 commit comments