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
[css-nav-1] Add more details about how to set the search origin
* Add how to set the search origin depending on its status change
* Add precise definition about `search origin` and `spatial navigation starting point`
* Seperate the "set the search origin" step from the processing model
* related to #3391
There can be a <dfn>spatial navigation starting point</dfn>. It is initially unset.
959
-
The user agent may set it when the user indicates that it should be moved.
960
-
961
-
Note: For example, the user agent could set it to the position of the user's click if the user clicks on the document contents,
962
-
and unset when the focus is moved (by spatial navigation or any other means).
963
-
964
-
If the User Agent sets both a <a>spatial navigation starting point</a> and a <a>sequential focus navigation starting point</a>,
965
-
they must not be set differently.
966
-
967
958
<div algorithm="to run the spatial navigation steps">
968
959
To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the following:
969
960
970
-
1. Let <var>searchOrigin</var> be the <a>DOM anchor</a> of the <a>currently focused area of a top-level browsing context</a>.
971
-
2. If the <a>spatial navigation starting point</a> is not <code>null</code>
972
-
and it is inside <var>searchOrigin</var>
973
-
then set <var>searchOrigin</var> to the <a>spatial navigation starting point</a>.
974
-
3.
961
+
1. Let <var>searchOrigin</var> be the result of <a>setting the search origin</a>.
962
+
2.
975
963
* If <var>searchOrigin</var> is an <a>node</a>,
976
964
let <var>eventTarget</var> be <var>searchOrigin</var>
977
965
* else (<a>assert</a>: <var>searchOrigin</var> is a position)
978
966
let <var>eventTarget</var> be the <a>node</a> which contains <var>searchOrigin</var>
979
-
4. If <var>eventTarget</var> is the <a>Document</a> or the <a>document element</a>,
967
+
3. If <var>eventTarget</var> is the <a>Document</a> or the <a>document element</a>,
980
968
set <var>eventTarget</var> be <a>the body element</a> if it is not <code>null</code>
981
969
or to the <a>document element</a> otherwise.
982
-
5.
970
+
4.
983
971
* If <var>searchOrigin</var> is <a>scroll container</a>
984
972
and the computed value of the 'spatial-navigation-action' property on <var>searchOrigin</var> is ''spatial-navigation-action/scroll''
985
973
and <var>searchOrigin</var>[=can be manually scrolled=],
@@ -1006,14 +994,14 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
1006
994
then <a>directionally scroll the element</a><var>eventTarget</var> in <var>direction</var> and return.
1007
995
* Else, fallback to the next step.
1008
996
* Else, fallback to the next step.
1009
-
6. Let <var>container</var> be the nearest ancestor of <var>eventTarget</var> that is a <a>spatial navigation container</a>.
1010
-
7. <i>Loop</i>: Let <var>candidates</var> be the result of <a>finding focusable areas</a>
997
+
5. Let <var>container</var> be the nearest ancestor of <var>eventTarget</var> that is a <a>spatial navigation container</a>.
998
+
6. <i>Loop</i>: Let <var>candidates</var> be the result of <a>finding focusable areas</a>
1011
999
within <var>container</var>
1012
1000
with the argument <var>visibleOnly</var> set to <code>false</code>
1013
1001
if computed value of the 'spatial-navigation-action' property on <var>container</var> is ''spatial-navigation-action/focus''
1014
1002
or to <code>true</code> otherwise,
1015
1003
excluding <var>searchOrigin</var>
1016
-
8. If <var>candidates</var> is empty:
1004
+
7. If <var>candidates</var> is empty:
1017
1005
* If the computed value of the 'spatial-navigation-action' property on <var>container</var> is not ''spatial-navigation-action/focus''
1018
1006
and <var>container</var> is a <a>scroll container</a> that <a>can be manually scrolled</a>,
1019
1007
<a>directionally scroll the element</a><var>container</var> in <var>direction</var> and return.
@@ -1036,16 +1024,16 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
1036
1024
4. Return to the step labeled <i>loop</i>.
1037
1025
* Else, set <var>container</var> to its closest ancestor that is itself a <a>spatial navigation container</a>
1038
1026
and return to the step labeled <i>loop</i>.
1039
-
9. Let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a>
1027
+
8. Let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a>
1040
1028
within <var>candidates</var> in <var>direction</var> starting from <var>searchOrigin</var>.
1041
-
10. If <a>navigation-override</a><a>is enabled</a> in the [=node document=] of <var>eventTarget</var> for the <a spec=html for="/">origin</a> of the [=active document=] of the [=top-level browsing context=], then
1029
+
9. If <a>navigation-override</a><a>is enabled</a> in the [=node document=] of <var>eventTarget</var> for the <a spec=html for="/">origin</a> of the [=active document=] of the [=top-level browsing context=], then
1042
1030
<span class=api><a>fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
1043
1031
* {{NavigationEvent/dir}} set to <var>direction</var>
1044
1032
* {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
1045
1033
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
1046
1034
1047
1035
and return if the result is <code>false</code>.</span>
1048
-
11. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return.
1036
+
10. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return.
1049
1037
1050
1038
</div>
1051
1039
@@ -1076,6 +1064,39 @@ The <dfn>inside area </dfn> of an object is defined as follows:
1076
1064
1077
1065
Issue(w3c/csswg-drafts#2324): CSS should have a term for “border box taking into account corner shaping properties like border-radius”.
1078
1066
1067
+
The <dfn>search origin</dfn> is the origin for searching next target.
1068
+
1069
+
The <dfn>spatial navigation starting point</dfn> is the origin for searching next target which is set by the User Agent. It is initially unset and it can be element or point.
1070
+
1071
+
Note: For example, the User Agent could set it to the position of the user's click if the user clicks on the document contents,
1072
+
and unset when the focus is moved (by spatial navigation or any other means).
1073
+
1074
+
If the User Agent sets both a <a>spatial navigation starting point</a> and a <a>sequential focus navigation starting point</a>,
1075
+
they must not be set differently.
1076
+
1077
+
<div algorithm="to set the search origin">
1078
+
1079
+
To <dfn lt="set the search origin | setting the search origin">set the search origin</dfn>,
1080
+
run the following steps:
1081
+
1082
+
1. Let <var>searchOrigin</var> be the <a>DOM anchor</a> of the <a>currently focused area of a top-level browsing context</a>.
1083
+
2. If the <a>spatial navigation starting point</a> is not <code>null</code>
1084
+
and it is inside <var>searchOrigin</var>,
1085
+
then return it.
1086
+
3. Otherwise, return <var>searchOrigin</var>.
1087
+
1088
+
If the focus changes not by the spatial navigation, the <var>searchOrigin</var> is set from the <var>old focus target</var> as following:
1089
+
1. If <var>old focus target</var> becomes out of the viewport by scrolling,
1090
+
then let <var>searchOrigin</var> be the scroll container which triggers the scroll behavior.
1091
+
2. If <var>old focus target</var> is inert,
1092
+
then let <var>searchOrigin</var> be the [=boundary box=] of <var>old focus target</var>.
1093
+
3. If the property of <var>old focus target</var> changes to <code>display: none</code> or <code>visibility: hidden</code>,
1094
+
then let <var>searchOrigin</var> be the [=boundary box=] of <var>old focus target</var>.
1095
+
4. Otherwise,
1096
+
let <var>searchOrigin</var> be the viewport of <var>old focus target</var>'s Document.
1097
+
1098
+
</div>
1099
+
1079
1100
<div algorithm="to find focusable areas">
1080
1101
1081
1102
To <dfn lt="find focusable areas | finding focusable areas">find focusable areas</dfn> within a containing element <var>C</var>,
0 commit comments