Skip to content

Commit 0e1fbcb

Browse files
author
Jihye Hong
committed
[css-nav-1] Modify example about spatial-navigation-contain
1 parent d059218 commit 0e1fbcb

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

css-nav-1/Overview.bs

+16-29
Original file line numberDiff line numberDiff line change
@@ -1338,15 +1338,15 @@ Note: In addition, as per [[#grouping]], the viewport of a <a for="/">browsing c
13381338

13391339
<div class=example>
13401340
The following example shows a simplified TV program schedule or calendar.
1341-
It has a grid of elements representing TV shows or calendar entries,
1341+
It has a grid of elements representing TV shows or calendar entries
13421342
and some UI buttons around it.
13431343

13441344
In this case, the grid is quite sparse,
13451345
so if the user tries to move down from "Foo",
13461346
focus would be moved to "Next Week",
13471347
as it is objectively closer in the down direction.
13481348
The same is true for going down from "Bar":
1349-
the focus would be moved to "Previous Week".
1349+
the focus would move to "Previous Week".
13501350

13511351
<div class=output>
13521352
<div id=example-cal>
@@ -1355,9 +1355,9 @@ Note: In addition, as per [[#grouping]], the viewport of a <a for="/">browsing c
13551355
<tr><td><th>M<th>T<th>W<th>T<th>F<th>S<th>S
13561356
<tr><td>0-6<td><td><td><td><td><td><td><a href="#">Foo</a>
13571357
<tr><td>6-9<td><a href="#">Bar</a><td><td><td><td><td><td>
1358-
<tr><td>9-12<td><td><td><td><td><td><td>
1358+
<tr><td>9-12<td><td><a href="#">Bat</a><td><td><td><td><td>
13591359
<tr><td>12-18<td><td><td><td><td><td><td>
1360-
<tr><td>18-21<td><td><td><td><td><td><td>
1360+
<tr><td>18-21<td><td><td><td><td><td><td><a href="#">Woo</a>
13611361
<tr><td>21-24<td><td><td><td><td><td><a href="#">Baz</a><td>
13621362
</table>
13631363
<button>Next Week</button>
@@ -1389,41 +1389,28 @@ Note: In addition, as per [[#grouping]], the viewport of a <a for="/">browsing c
13891389
&lt;tr>&lt;td>&lt;th>M&lt;th>T&lt;th>W&lt;th>T&lt;th>F&lt;th>S&lt;th>S
13901390
&lt;tr>&lt;td>0-6&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;a href="#">Foo&lt;/a>
13911391
&lt;tr>&lt;td>6-9&lt;td>&lt;a href="#">Bar&lt;/a>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>
1392-
&lt;tr>&lt;td>9-12&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>
1392+
&lt;tr>&lt;td>9-12&lt;td>&lt;td>&lt;a href="#">Bat&lt;/a>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>
13931393
&lt;tr>&lt;td>12-18&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>
1394-
&lt;tr>&lt;td>18-21&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>
1394+
&lt;tr>&lt;td>18-21&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;a href="#">Woo&lt;/a>
13951395
&lt;tr>&lt;td>21-24&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;td>&lt;a href="#">Baz&lt;/a>&lt;td>
13961396
&lt;/table>
13971397
&lt;button>Next Week&lt;/button>
13981398
&lt;/div>
13991399
</code></pre>
1400-
<pre><code highlight=css>
1401-
table, td, th {
1402-
border-collapse: collapse;
1403-
border: solid 1px;
1404-
}
1405-
td { width: 12.5%; }
1406-
div {
1407-
display: grid;
1408-
grid-template-columns: auto 1fr auto;
1409-
}
1410-
button { align-self: center; }
1411-
</code></pre>
14121400

1413-
Because the elements in the table are semantically related to each other,
1414-
the author may want to provide a different navigation experience
1415-
giving priority to movements inside the grid once you have focused one of its items.
1401+
However, the author may want to provide a different navigation experience
1402+
giving priority to movements inside the grid once you have focused one of its items
1403+
because the elements in the table are semantically related to each other.
14161404

14171405
Adding <code highlight=css>table { spatial-navigation-contain: contain; }</code> to the stylesheet
14181406
would result this behavior.
1419-
It would still be possible to move the focus out of the table,
1420-
for example by going right from "Foo".
1421-
Since there is nothing in the grid that is to the right,
1422-
the focus would move to "Next week".
1423-
1424-
However, if the user navigates down from "Foo",
1425-
there is something inside the grid,
1426-
so focus will move there without considering things that are outside.
1407+
1408+
After that, the focus would move down from "Foo" to "Woo" instead of "Next Week",
1409+
and from "Bar" to "Bat" instead of "Previous Week".
1410+
1411+
It would still be possible to move the focus out of the table.
1412+
For example, the focus would move to "Next week" by going right from "Foo"
1413+
since there is nothing in the grid that is to the right.
14271414
</div>
14281415

14291416
Note: the 'spatial-navigation-contain' property is <a>at-risk</a>.

0 commit comments

Comments
 (0)