Skip to content

Commit 1d9bf0c

Browse files
author
Jihye Hong
committed
[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
1 parent 3460143 commit 1d9bf0c

File tree

1 file changed

+43
-22
lines changed

1 file changed

+43
-22
lines changed

css-nav-1/Overview.bs

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -955,31 +955,19 @@ Navigation</h3>
955955
<object type="image/svg+xml" data="images/spatnav_processing_model_diagram.svg"></object>
956956
</figure>
957957

958-
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-
967958
<div algorithm="to run the spatial navigation steps">
968959
To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the following:
969960

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.
975963
* If <var>searchOrigin</var> is an <a>node</a>,
976964
let <var>eventTarget</var> be <var>searchOrigin</var>
977965
* else (<a>assert</a>: <var>searchOrigin</var> is a position)
978966
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>,
980968
set <var>eventTarget</var> be <a>the body element</a> if it is not <code>null</code>
981969
or to the <a>document element</a> otherwise.
982-
5.
970+
4.
983971
* If <var>searchOrigin</var> is <a>scroll container</a>
984972
and the computed value of the 'spatial-navigation-action' property on <var>searchOrigin</var> is ''spatial-navigation-action/scroll''
985973
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
1006994
then <a>directionally scroll the element</a> <var>eventTarget</var> in <var>direction</var> and return.
1007995
* Else, fallback to the next step.
1008996
* 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>
1011999
within <var>container</var>
10121000
with the argument <var>visibleOnly</var> set to <code>false</code>
10131001
if computed value of the 'spatial-navigation-action' property on <var>container</var> is ''spatial-navigation-action/focus''
10141002
or to <code>true</code> otherwise,
10151003
excluding <var>searchOrigin</var>
1016-
8. If <var>candidates</var> is empty:
1004+
7. If <var>candidates</var> is empty:
10171005
* If the computed value of the 'spatial-navigation-action' property on <var>container</var> is not ''spatial-navigation-action/focus''
10181006
and <var>container</var> is a <a>scroll container</a> that <a>can be manually scrolled</a>,
10191007
<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
10361024
4. Return to the step labeled <i>loop</i>.
10371025
* Else, set <var>container</var> to its closest ancestor that is itself a <a>spatial navigation container</a>
10381026
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>
10401028
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
10421030
<span class=api><a>fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
10431031
* {{NavigationEvent/dir}} set to <var>direction</var>
10441032
* {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
10451033
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
10461034

10471035
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.
10491037

10501038
</div>
10511039

@@ -1076,6 +1064,39 @@ The <dfn>inside area </dfn> of an object is defined as follows:
10761064

10771065
Issue(w3c/csswg-drafts#2324): CSS should have a term for “border box taking into account corner shaping properties like border-radius”.
10781066

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+
10791100
<div algorithm="to find focusable areas">
10801101

10811102
To <dfn lt="find focusable areas | finding focusable areas">find focusable areas</dfn> within a containing element <var>C</var>,

0 commit comments

Comments
 (0)