Skip to content

Commit d9a9947

Browse files
author
Jihye Hong
committed
[css-nav-1] Add spatial-navigation-function CSS property
During the CSS WG F2F, it was resolved to add `spatial-navigation-function` CSS property. This property is used for setting the focus navigation algorithm with the predefined values. Close w3c#3964
1 parent d9e91be commit d9a9947

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

css-nav-1/Overview.bs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ At risk: {{getSpatialNavigationContainer()}}
1515
At risk: {{focusableAreas()}}
1616
At risk: 'spatial-navigation-contain'
1717
At risk: ''spatial-navigation-action: scroll''
18+
At risk: 'spatial-navigation-function'
1819
</pre>
1920
<pre class="anchors">
2021
spec: ui-events; urlPrefix: https://w3c.github.io/uievents/;
@@ -1496,6 +1497,56 @@ Pressing the down arrow key moves the focus directly to it without scrolling man
14961497

14971498
</div>
14981499

1500+
<h3 id=css-property-spatialnavigationfunction>
1501+
Selecting the navigation algorithm: the 'spatial-navigation-function' property</h3>
1502+
1503+
<pre class='propdef'>
1504+
Name: spatial-navigation-function
1505+
Value: normal | grid
1506+
Initial: normal
1507+
Applies to: <a>spatial navigation container</a>
1508+
Inherited: yes
1509+
</pre>
1510+
1511+
Depending on the layout types, the default algorithm of spatial navigation may need the fine tune.
1512+
1513+
<dl dfn-for=spatial-navigation-function dfn-type=value>
1514+
<dt><dfn>normal</dfn>
1515+
<dd>
1516+
Moves the focus with the default focus navigation algorithm defined by UA.
1517+
In general, the focus moves to the closest element from the <a>spatial navigation starting point</a>.
1518+
1519+
<dt><dfn>grid</dfn>
1520+
<dd>
1521+
Moves the focus to the closest element based on 2D rectilinear distance.
1522+
1523+
If there are more than one aligned candidates in the navigation direction,
1524+
Among the aligned candidates, select the best one as a result of the calculation from the distance
1525+
along the axis which corresponds to the navigation direction.
1526+
In case of best candidates more than two, select the best one with the minimum amount of alignment.
1527+
1528+
Else if there isn't any aligned candidate in a given direction,
1529+
Among not aligned)candidates, select the best ones as a result of calculation from the distance
1530+
along the axis which corresponds to the navigation direction.
1531+
In case of best candidates more than two, select the best one with the minimum distance
1532+
along the axis which is orthogonal to the navigation direction.
1533+
</dl>
1534+
1535+
<div class=example>
1536+
This example shows how the focus moves differently by the value of <code>spatial-navigation-function</code>.
1537+
1538+
<figure>
1539+
<img alt="" src="images/spatnav-function.png" style="width: 500px;"/>
1540+
<figcaption>Moving focus from "A" to one of the candidate elements</figcaption>
1541+
</figure>
1542+
1543+
Let the element which contains "A", "B", "C" and "D" is the <a>spatial navigation focus container</a>.
1544+
1545+
If <code>normal</code> value is given to <code>spatial-navigation-function</code> of the element,
1546+
when the user presses the down arrow key, the focus will move to "C".
1547+
Otherwise, <code>grid</code> was specified to the element, the focus will move to "B".
1548+
</div>
1549+
14991550
<h2 class=no-num id=scrolling>Appendix A. Scroll extensions</h2>
15001551

15011552
This section proposes a few extensions to CSS
7.98 KB
Loading

0 commit comments

Comments
 (0)