@@ -1229,7 +1229,7 @@ NOTE: The values of <var>alignWeight</var> and <var>orthogonalWeight</var> in th
1229
1229
<h2 id=declarative>
1230
1230
Controlling spatial navigation through declarative means</h2>
1231
1231
1232
- <h3 id=container >
1232
+ <h3 id=css-property-spatialnavigationcontain >
1233
1233
Creating additional spatial navigation containers: the 'spatial-navigation-contain' property</h3>
1234
1234
1235
1235
<pre class='propdef'>
@@ -1347,6 +1347,81 @@ Note: the 'spatial-navigation-contain' property is <a>at-risk</a>.
1347
1347
1348
1348
</div>
1349
1349
1350
+ <h3 id=css-property-spatialnavigationaction>
1351
+ Defining the spatial navigation behavior : the 'spatial-navigation-action' property</h3>
1352
+
1353
+ <pre class='propdef'>
1354
+ Name : spatial-navigation-action
1355
+ Value : auto | focus | scroll
1356
+ Initial : auto
1357
+ Applies to : <a>scroll container</a>
1358
+ Inherited : true
1359
+ </pre>
1360
+
1361
+ When the user triggers spatial navigation in a given direction, the 'spatial-navigation-action' decides
1362
+ the proper spatial navigation behavior.
1363
+
1364
+ <dl dfn-for=spatial-navigation-action dfn-type=value>
1365
+ <dt> <dfn>auto</dfn>
1366
+ <dd> If the element is a <a>scroll container</a> ,
1367
+ then directional input moves the focus to the candidates in the optimal viewing region.
1368
+ When there isn't any visible candidate, then the container scrolls.
1369
+
1370
+ Otherwise, the focus moves to the candidates in the viewport.
1371
+
1372
+ <dt> <dfn>focus</dfn>
1373
+ <dd> The directional input moves the focus to all candidates inside a scroll container. The container <a>cannot be scrolled manually</a> .
1374
+
1375
+ NOTE: If the 'focus' value is given to 'spatial-navigation-action' ,
1376
+ <a event>navnotarget</a> event occurs when there isn’t any visible candidate in the given direction within the viewport of
1377
+ the <a>spatial navigation container</a> even through the container can be scrolled more.
1378
+
1379
+ <dt> <dfn>scroll</dfn>
1380
+ <dd> If the element is a <a>scroll container</a> ,
1381
+ then directional input only works for manually scrolling the container.
1382
+
1383
+ Note: The 'scroll' value is <a>at-risk</a> .
1384
+ </dl>
1385
+
1386
+ <div class=example>
1387
+ In this example, a scrollable container is specified with <code highlight=css> spatial-navigation-action: focus</code> .
1388
+ Inside the container, there is an element which is out of the view within a <a>scrollport</a> .
1389
+ Pressing the right arrow key moves the focus directly to it without scrolling manually.
1390
+
1391
+ <figure>
1392
+ <img alt="" src="images/spatnav-action.png" style="width: 500px;"/>
1393
+ <figcaption> Moving focus from "Box 2" to "Box 3" without manually scrolling</figcaption>
1394
+ </figure>
1395
+
1396
+ <pre><code highlight=markup>
1397
+ <div class = 'scroller' >
1398
+ <button class = 'item' >Box 1</button>
1399
+ <button class = 'item' >Box 2</button>
1400
+ <button class = 'item' >Box 3</button>
1401
+ </div>
1402
+ </code></pre>
1403
+ <pre><code highlight=css>
1404
+ .scroller {
1405
+ display: grid;
1406
+ grid-template-columns: repeat(1, 1fr);
1407
+ height: 300px;
1408
+ width: 200px;
1409
+ overflow-y: scroll;
1410
+ spatial-navigation-action: focus;
1411
+ }
1412
+ .item {
1413
+ height: 100px;
1414
+ width: 100px;
1415
+ margin: 50px auto;
1416
+ background-color: blue;
1417
+ }
1418
+ :focus {
1419
+ background-color: red;
1420
+ }
1421
+ </code></pre>
1422
+
1423
+ </div>
1424
+
1350
1425
<h2 class=no-num id=scrolling>Appendix A. Scroll extensions</h2>
1351
1426
1352
1427
This section proposes a few extensions to CSS
0 commit comments