Skip to content

Commit 2a8b6a9

Browse files
committed
[css-nav-1] Update the algorithm to reflect spatial-navigation-action
1 parent e3825a5 commit 2a8b6a9

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

css-nav-1/Overview.bs

+34-20
Original file line numberDiff line numberDiff line change
@@ -975,29 +975,43 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
975975
4. If <var>eventTarget</var> is the <a>Document</a> or the <a>document element</a>,
976976
set <var>eventTarget</var> be <a>the body element</a> if it is not <code>null</code>
977977
or to the <a>document element</a> otherwise.
978-
5. If <var>searchOrigin</var> is either a <a>scroll container</a> or the <a>document</a>
979-
1. Let <var>candidates</var> be the result of <a>finding focusable areas</a>
980-
within <var>searchOrigin</var>
981-
2.
982-
* If <var>candidates</var> contains at least 1 item:
983-
1. Let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a>
984-
within <var>candidates</var> in <var>direction</var> starting from <var>searchOrigin</var>
985-
2. 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
986-
<span class=api><a>fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
987-
* {{NavigationEvent/dir}} set to <var>direction</var>
988-
* {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
989-
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
990-
991-
and return if the result is <code>false</code>.</span>
992-
3. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return
993-
* Else if <var>eventTarget</var> <a>can be manually scrolled</a>,
994-
<a>directionally scroll the element</a> <var>eventTarget</var> in <var>direction</var> and return.
995-
* Else, fallback to the next step.
978+
5.
979+
* If <var>searchOrigin</var> is <a>scroll container</a>
980+
and the computed value of the 'spatial-navigation-action' property on <var>searchOrigin</var> is ''spatial-navigation-action/scroll''
981+
and <var>searchOrigin</var> [=can be manually scrolled=],
982+
then [=directionally scroll the element=] <var>searchOrigin</var> and return.
983+
* Else, if <var>searchOrigin</var> is either a <a>scroll container</a> or the <a>document</a>
984+
1. Let <var>candidates</var> be the result of <a>finding focusable areas</a>
985+
within <var>searchOrigin</var>
986+
with the argument set to <code>false</code> if computed value of the 'spatial-navigation-action' property on <var>searchOrigin</var> is ''spatial-navigation-action/focus''
987+
or to <code>true</code> otherwise.
988+
2.
989+
* If <var>candidates</var> contains at least 1 item:
990+
1. Let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a>
991+
within <var>candidates</var> in <var>direction</var> starting from <var>searchOrigin</var>
992+
2. 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
993+
<span class=api><a>fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
994+
* {{NavigationEvent/dir}} set to <var>direction</var>
995+
* {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
996+
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
997+
998+
and return if the result is <code>false</code>.</span>
999+
3. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return
1000+
* Else if the computed value of the 'spatial-navigation-action' property on <var>eventTarget</var> is not ''spatial-navigation-action/focus''
1001+
and <var>eventTarget</var> <a>can be manually scrolled</a>,
1002+
then <a>directionally scroll the element</a> <var>eventTarget</var> in <var>direction</var> and return.
1003+
* Else, fallback to the next step.
1004+
* Else, fallback to the next step.
9961005
6. Let <var>container</var> be the nearest ancestor of <var>eventTarget</var> that is a <a>spatial navigation container</a>.
9971006
7. <i>Loop</i>: Let <var>candidates</var> be the result of <a>finding focusable areas</a>
998-
within <var>container</var>, excluding <var>searchOrigin</var>
1007+
within <var>container</var>
1008+
with the argument set to <code>false</code>
1009+
if computed value of the 'spatial-navigation-action' property on <var>container</var> is ''spatial-navigation-action/focus''
1010+
or to <code>true</code> otherwise,
1011+
excluding <var>searchOrigin</var>
9991012
8. If <var>candidates</var> is empty:
1000-
* If <var>container</var> is a <a>scroll container</a> that <a>can be manually scrolled</a>,
1013+
* If the computed value of the 'spatial-navigation-action' property on <var>container</var> is not ''spatial-navigation-action/focus''
1014+
and <var>container</var> is a <a>scroll container</a> that <a>can be manually scrolled</a>,
10011015
<a>directionally scroll the element</a> <var>container</var> in <var>direction</var> and return.
10021016
* Else,
10031017
1. 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

0 commit comments

Comments
 (0)