You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-nav-1/Overview.bs
+60-30Lines changed: 60 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -1154,11 +1154,11 @@ Issue(w3c/csswg-drafts#2324): CSS should have a term for “border box taking in
1154
1154
1155
1155
To <dfn lt="find focusable areas | finding focusable areas">find focusable areas</dfn> within a containing element <var>C</var>,
1156
1156
with an optional <var>visibleOnly</var> argument that defaults to <code>true</code>,
1157
-
follow the following steps:
1157
+
run the following steps:
1158
1158
1159
1159
1. Let <var>focusables</var> be the <a spec=infra for="/">set</a> of all the <a>focusable areas</a> whose [=DOM anchor=] are descendants of <var>C</var>.
1160
1160
In the case of [=boxes=] with several [=box fragments=], each [=box fragment=] is considered separately.
1161
-
2. The UA should <a spec=infra for=set>remove</a> from <var>focusables</var> items that have a [=DOM anchor=] whose <a element-attr spec=html><code>tabindex</code></a> attribute is set to a negative value.
1161
+
2. The User Agent should <a spec=infra for=set>remove</a> from <var>focusables</var> items that have a [=DOM anchor=] whose <a element-attr spec=html><code>tabindex</code></a> attribute is set to a negative value.
1162
1162
1163
1163
Note: This is a "SHOULD" in order to mirror the exclusion of elements with negative tabindex
1164
1164
from the <a>sequential focus navigation order</a> as defined in [[HTML#the-tabindex-attribute]].
@@ -1200,7 +1200,7 @@ To <dfn lt="select the best candidate | selecting the best candidate">select the
1200
1200
within a <a spec=infra for="/">set</a> of <var>candidates</var>
1201
1201
in a direction <var>dir</var>,
1202
1202
starting from <var>searchOrigin</var>,
1203
-
follow the following steps:
1203
+
run the following steps:
1204
1204
1205
1205
1. If <var>candidates</var> is <a spec=infra for=set>empty</a>, return <code>null</code>
1206
1206
2. If <var>candidates</var> contains a single item, return that item
@@ -1211,19 +1211,19 @@ follow the following steps:
1211
1211
4. Let <var>insiders</var> be the subset of <var>candidates</var> items
1212
1212
whose [=DOM anchor=] are descendants of <var>searchOrigin</var>
1213
1213
and whose <a>boundary box</a>'s
1214
-
* top edge is below the top edge of <var>insideArea</var> if <var>dir</var> is <code>down</code>
1215
-
* bottom edge is above the bottom edge of <var>insideArea</var> if <var>dir</var> is <code>up</code>
1216
-
* right edge is left of the right edge of <var>insideArea</var> if <var>dir</var> is <code>left</code>
1217
-
* left edge is right of the left edge of <var>insideArea</var> if <var>dir</var> is <code>right</code>
1214
+
* top edge is below the top edge of <var>insideArea</var> if <var>dir</var> is {{SpatialNavigationDirection/down}}
1215
+
* bottom edge is above the bottom edge of <var>insideArea</var> if <var>dir</var> is {{SpatialNavigationDirection/up}}
1216
+
* right edge is left of the right edge of <var>insideArea</var> if <var>dir</var> is {{SpatialNavigationDirection/left}}
1217
+
* left edge is right of the left edge of <var>insideArea</var> if <var>dir</var> is {{SpatialNavigationDirection/right}}
1218
1218
1219
1219
Note: this sub-setting is necessary to avoid going in the opposite direction than the one requested.
1220
1220
5.
1221
1221
* If <var>insiders</var> is non empty
1222
1222
1. Let <var>closest subset</var> be the subset of <var>insiders</var> whose <a>boundary box</a>'s
1223
-
* top edge is closest to the top edge of <var>insideArea</var> if <var>dir</var> is <code>down</code>
1224
-
* bottom edge is closest to the bottom edge of <var>insideArea</var> if <var>dir</var> is <code>up</code>
1225
-
* right edge is closest to the right edge of <var>insideArea</var> if <var>dir</var> is <code>left</code>
1226
-
* left edge is closest to the left edge of <var>insideArea</var> if <var>dir</var> is <code>right</code>
1223
+
* top edge is closest to the top edge of <var>insideArea</var> if <var>dir</var> is {{SpatialNavigationDirection/down}}
1224
+
* bottom edge is closest to the bottom edge of <var>insideArea</var> if <var>dir</var> is {{SpatialNavigationDirection/up}}
1225
+
* right edge is closest to the right edge of <var>insideArea</var> if <var>dir</var> is {{SpatialNavigationDirection/left}}
1226
+
* left edge is closest to the left edge of <var>insideArea</var> if <var>dir</var> is {{SpatialNavigationDirection/right}}
1227
1227
2. If <var>closest subset</var> contains a single item,
1228
1228
return that item,
1229
1229
else return the first item of <var>closest subset</var> in document order,
@@ -1242,7 +1242,7 @@ follow the following steps:
1242
1242
of <var>searchOrigin</var> and P2 inside the boundary box of <var>candidate</var>.
1243
1243
2. Else if the <var>searchOrigin</var> is a point, then let the point <var>P1</var> be the <var>searchOrigin</var>
1244
1244
and find the point <var>P2</var> inside the <a>boundary box</a>.
1245
-
3. Let <var>intersectRect</var>is intersected area between a candidate and the search origin.
1245
+
3. Let <var>intersectRect</var>be an <dfn>intersecting area</dfn> between the search origin and a candidate.
1246
1246
4. Select the <var>P1</var> and <var>P2</var> that make the smallest <var>distance</var> between those two points by
1247
1247
<a>calculating the distance</a>.
1248
1248
5. Return the item of the <var>candidates</var> set that has the smallest <var>distance</var>.
@@ -1258,7 +1258,7 @@ follow the following steps:
1258
1258
To <dfn lt="calculating the distance | to calculate the distance">calculate the <var>distance</var></dfn>, the function is defined as below:
The meaning of each factor in the function is as follows:
@@ -1267,39 +1267,69 @@ The meaning of each factor in the function is as follows:
1267
1267
<dt><var>euclidian</var>
1268
1268
<dd>The euclidian distance between <var>P1</var> and <var>P2</var>
1269
1269
1270
+
<dt><var>displacement</var>
1271
+
<dd>The degree of displacement in <var>dir</var> between <var>searchOrigin</var> and <var>candidate</var>
1272
+
<dd>Defined as <pre class="prod">(absolute distance on the axis orthogonal to <var>dir</var> + <var>orthogonalBias</var>) * <var>orthogonalWeight</var></pre>
1273
+
1274
+
* <var>orthogonalBias</var>
1275
+
* If the <var>dir</var> is {{SpatialNavigationDirection/left}} or {{SpatialNavigationDirection/right}},
1276
+
height of <var>searchOrigin</var> / 2
1277
+
* Else if the <var>dir</var> is {{SpatialNavigationDirection/up}} or {{SpatialNavigationDirection/down}},
1278
+
width of <var>searchOrigin</var> / 2
1279
+
1280
+
* <var>orthogonalWeight</var>:
1281
+
* If the <var>dir</var> is {{SpatialNavigationDirection/left}} or {{SpatialNavigationDirection/right}}, 30
1282
+
* Else if the <var>dir</var> is {{SpatialNavigationDirection/up}} or {{SpatialNavigationDirection/down}}, 2
1283
+
1270
1284
<dt><var>alignment</var>
1271
1285
<dd>The degree of alignment in <var>dir</var> between <var>searchOrigin</var> and <var>candidate</var>
1272
1286
<dd>Defined as <pre class="prod"><var>alignBias</var> * <var>alignWeight</var></pre>
1273
1287
1274
1288
* <var>alignBias</var>
1275
1289
1276
-
* If the <var>dir</var> is left or right, height of <var>intersectRect</var> / the height of <var>candidate</var>
1277
-
* Else if the <var>dir</var> is up or down, width of <var>intersectRect</var> / the width of <var>candidate</var>
1290
+
* If the <var>dir</var> is {{SpatialNavigationDirection/left}} or {{SpatialNavigationDirection/right}},
1291
+
height of <var>intersectRect</var> / height of <var>candidate</var>
1292
+
* Else if the <var>dir</var> is {{SpatialNavigationDirection/up}} or {{SpatialNavigationDirection/down}},
1293
+
width of <var>intersectRect</var> / width of <var>candidate</var>
1278
1294
1279
1295
* <var>alignWeight</var> is 5
1280
1296
1281
-
<dt><var>displacement</var>
1282
-
<dd>The degree of displacement in <var>dir</var> between <var>searchOrigin</var> and <var>candidate</var>
1283
-
<dd>Defined as <pre class="prod">(absolute distance on the axis orthogonal to <var>dir</var> + <var>orthogonalBias</var>) * <var>orthogonalWeight</var></pre>
1284
-
1285
-
* <var>orthogonalBias</var>
1286
-
* If the <var>dir</var> is left or right, height of <var>searchOrigin</var> / 2
1287
-
* Else if the <var>dir</var> is up or down, width of <var>searchOrigin</var> / 2
1288
-
1289
-
* <var>orthogonalWeight</var>:
1290
-
* If the <var>dir</var> is left or right, 30
1291
-
* Else if the <var>dir</var> is up or down, 2
1292
-
1293
1297
<dt><var>sqrt(Overlap)</var>
1294
-
<dd>The square root of the <var>intersectRect</var>(overlapped area) between the <a>boundary boxes</a> of <var>candidate</var> and <var>searchOrigin</var>
1295
-
<dd>Defined as <pre class="prod">sqrt(height of <var>intersectRect</var> * width of <var>intersectRect</var>)</pre>
1298
+
<dd>The square root of an <a>overlapping area</a> between the <a>boundary boxes</a> of <var>searchOrigin</var> and <var>candidate</var>
1299
+
<dd>Let <var>overlapRect</var> be
1300
+
<var>intersectRect</var> if the <a>overlapping area</a> exists,
1301
+
and 0 otherwise.
1302
+
<dd>Defined as <pre class="prod">sqrt(height of <var>overlapRect</var> * width of <var>overlapRect</var>)</pre>
1296
1303
</dl>
1297
1304
1298
1305
NOTE: The values of <var>alignWeight</var> and <var>orthogonalWeight</var> in the function are decided based on
1299
1306
the collected <a href="https://wicg.github.io/spatial-navigation/tests/ux/list.html">UX test cases</a>.
1300
-
It aims to show the general expected result in the real pages.
1307
+
It aims to show the generally expected result in the real pages.
1301
1308
Everyone is welcome to contribute to the test cases!
1302
1309
1310
+
<div class='example'>
1311
+
This example shows how the <a>intersecting area</a>(<var>intersectRect</var>) is defined.
<figcaption>The <a>intersecting area</a> when the elements are aligned.</figcaption>
1325
+
</figure>
1326
+
1327
+
In the case above, the search origin element and the candidate element are aligned and the requested direction is {{SpatialNavigationDirection/right}}.
1328
+
The <a>intersecting area</a> is created with
1329
+
(1) The gap between two elements.
1330
+
(2) The parts of the edges from each element which are overlapped
1331
+
when the right edge of the search origin element and the left edge of the candidate are projected to each other.
0 commit comments