Skip to content

Commit 57ef8a9

Browse files
author
Jihye Hong
committed
Polishing the processing model section
* Fix the confusing usages of 'search origin' terminology * Add the definition of "Dispatching navbeforefocus event" and "Dispatching navnotarget event"
1 parent d4edbd8 commit 57ef8a9

File tree

1 file changed

+40
-38
lines changed

1 file changed

+40
-38
lines changed

css-nav-1/Overview.bs

+40-38
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ spec: ui-events; urlPrefix: https://w3c.github.io/uievents/;
2222
type: event;
2323
text: keydown
2424
text: click
25+
type: dfn;
26+
text: event target
2527
spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/;
2628
urlPrefix: interaction.html
2729
type: dfn;
@@ -691,7 +693,7 @@ For full normative details, see [[#processing-model]].
691693
<h4 id="event-type-navbeforefocus" class="non-normative">
692694
<dfn event for=NavigationEvent>navbeforefocus</dfn></h4>
693695

694-
The <a event>navbeforefocus</a> event occurs before spatial navigation changes the focus.
696+
This event occurs when there is a valid result of <a>selecting the best candidate</a>.
695697

696698
<table class="def">
697699
<tbody>
@@ -710,6 +712,9 @@ The <a event>navbeforefocus</a> event occurs before spatial navigation changes t
710712
<tr>
711713
<th>Attributes of the event
712714
<td><dl>
715+
<dt>{{Event}}.{{Event/target}}
716+
<dd>The element receiving focus
717+
713718
<dt>{{NavigationEvent}}.{{NavigationEvent/relatedTarget}}
714719
<dd>The DOM anchor of the focusable area that will be focused
715720

@@ -719,6 +724,14 @@ The <a event>navbeforefocus</a> event occurs before spatial navigation changes t
719724
</tbody>
720725
</table>
721726

727+
The User Agent <dfn lt="dispatches navbeforefocus event | dispatching navbeforefocus event">dispatches <a event>navbeforefocus</a> event</dfn>
728+
before spatial navigation moves the focus.
729+
The <a>event target</a> is the element which has focus and
730+
the {{NavigationEvent/relatedTarget}} is the element which is about to receive focus.
731+
732+
If <a>navigation-override</a> is disabled in the [=node document=] of <var>eventTarget</var> for
733+
the <a spec=html for="/">origin</a> of the [=active document=] of the [=top-level browsing context=], this event won't be dispatched.
734+
722735
<div class='example'>
723736
This example shows the [[UI-EVENTS#event-order]] when pressing the <code class=key>ArrowRight</code>
724737
key.
@@ -763,7 +776,7 @@ The <a event>navbeforefocus</a> event occurs before spatial navigation changes t
763776
<h4 id="event-type-navnotarget" class="non-normative">
764777
<dfn event for=NavigationEvent>navnotarget</dfn></h4>
765778

766-
The <a event>navnotarget</a> event occurs before going up the tree to search candidates in the
779+
This event occurs before going up the tree to search candidates in the
767780
nearest ancestor <a>spatial navigation container</a> when spatial navigation has failed to find any candidate
768781
within the current <a>spatial navigation container</a>,
769782
and in cases where the <a>spatial navigation container</a> is scrollable,
@@ -786,6 +799,9 @@ when it cannot be scrolled further.
786799
<tr>
787800
<th>Attributes of the event
788801
<td><dl>
802+
<dt>{{Event}}.{{Event/target}}
803+
<dd>The element receiving focus
804+
789805
<dt>{{NavigationEvent}}.{{NavigationEvent/relatedTarget}}
790806
<dd>The <a>spatial navigation container</a> that was searched in.
791807

@@ -795,6 +811,13 @@ when it cannot be scrolled further.
795811
</tbody>
796812
</table>
797813

814+
The User Agent <dfn lt="dispatches navnotarget event | dispatching navnotarget event">dispatches <a event>navnotarget</a> event</dfn>
815+
with initializing the <a>event target</a> as the element which has focus and
816+
the {{NavigationEvent/relatedTarget}} as <a>spatial navigation container</a> of the <a>event target</a>.
817+
818+
If <a>navigation-override</a> is disabled in the [=node document=] of <var>eventTarget</var> for
819+
the <a spec=html for="/">origin</a> of the [=active document=] of the [=top-level browsing context=], this event won't be dispatched.
820+
798821
<div class='example'>
799822
This example shows the [[UI-EVENTS#event-order]] when pressing the <code class=key>ArrowDown</code>
800823
key in the situation like the following figure.
@@ -947,7 +970,6 @@ to fully define the behavior.
947970
Issue(w3c/csswg-drafts#3376): The following currently does not account
948971
for <a href="https://github.com/WICG/overscroll-behavior">the proposed overscroll-behavior specification</a>.
949972

950-
951973
<h3 id=grouping>
952974
Groupings of elements</h3>
953975

@@ -996,15 +1018,15 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
9961018
set <var>eventTarget</var> be <a>the body element</a> if it is not <code>null</code>
9971019
or to the <a>document element</a> otherwise.
9981020
4. <ul>
999-
<span class=cssapi><li>If <var>searchOrigin</var> is <a>scroll container</a>
1000-
and the computed value of the 'spatial-navigation-action' property on <var>searchOrigin</var> is ''spatial-navigation-action/scroll''
1001-
and <var>searchOrigin</var> [=can be manually scrolled=],
1002-
then [=directionally scroll the element=] <var>searchOrigin</var> and return.</li></span>
1003-
<li><span class=cssapi>Else,</span> if <var>searchOrigin</var> is either a <a>scroll container</a> or the <a>document</a>
1021+
<span class=cssapi><li>If <var>eventTarget</var> is <a>scroll container</a>
1022+
and the computed value of the 'spatial-navigation-action' property on <var>eventTarget</var> is ''spatial-navigation-action/scroll''
1023+
and <var>eventTarget</var> [=can be manually scrolled=],
1024+
then [=directionally scroll the element=] <var>eventTarget</var> and return.</li></span>
1025+
<li><span class=cssapi>Else,</span> if <var>eventTarget</var> is either a <a>scroll container</a> or the <a>document</a>
10041026
1. Let <var>candidates</var> be the result of <a>finding focusable areas</a>
1005-
within <var>searchOrigin</var>
1027+
within <var>eventTarget</var>
10061028
with the argument <var>visibleOnly</var> set to <code>false</code>
1007-
<span class=cssapi>if computed value of the 'spatial-navigation-action' property on <var>searchOrigin</var>
1029+
<span class=cssapi>if computed value of the 'spatial-navigation-action' property on <var>eventTarget</var>
10081030
is ''spatial-navigation-action/focus'' or to <code>true</code> otherwise.
10091031
</span>
10101032
2.
@@ -1016,17 +1038,9 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
10161038
<li><span class=cssapi>Else </span>if <var>candidates</var> contains at least 1 item:
10171039
1. Let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a>
10181040
within <var>candidates</var> in <var>direction</var> starting from <var>searchOrigin</var>
1019-
<p class=api>
1020-
2. If <a>navigation-override</a> <a>is enabled</a> in the [=node document=] of <var>eventTarget</var> for
1021-
the <a spec=html for="/">origin</a> of the [=active document=] of the [=top-level browsing context=], then
1022-
<a>fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
1023-
<ul>
1024-
<li>{{NavigationEvent/dir}} set to <var>direction</var>
1025-
<li>{{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
1026-
<li>the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
1027-
</ul>
1028-
and return if the result is <code>false</code>.
1029-
</p>
1041+
<p class=api>
1042+
2. <a>Dispatches navbeforefocus event</a> at <var>eventTarget</var> with <var>direction</var> and <var>bestCandidate</var>.
1043+
</p>
10301044
3. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return
10311045
</li>
10321046
<li>Else, fall back to the next step.</li>
@@ -1041,7 +1055,7 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
10411055
<span class=cssapi>
10421056
if computed value of the 'spatial-navigation-action' property on <var>container</var> is ''spatial-navigation-action/focus''
10431057
or to <code>true</code> otherwise,
1044-
excluding <var>searchOrigin</var>
1058+
excluding <var>eventTarget</var>
10451059
</span>
10461060
7. If <var>candidates</var> is empty:
10471061
<ul>
@@ -1050,34 +1064,22 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
10501064
<a>directionally scroll the element</a> <var>container</var> in <var>direction</var> and return.
10511065
</li></span>
10521066
<span class=cssapi><li>Else,</li></span>
1053-
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
1054-
<span class=api><a>fire an event</a> named <a event>navnotarget</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
1055-
* {{NavigationEvent/dir}} set to <var>direction</var>
1056-
* {{NavigationEvent/relatedTarget}} set to <var>container</var>
1057-
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
1058-
1059-
and return if the result is <code>false</code>.</span>
1067+
1. <a>Dispatches navnotarget event</a> at <var>eventTarget</var> with <var>direction</var> and <var>container</var>.
10601068
2.
10611069
* If <var>container</var> is the <a>document element</a> of the <a>top-level browsing context</a>,
10621070
then return.
10631071
The User Agent may transfer focus to its own controls (if any) honouring <var>direction</var>.
10641072
* Else, if <var>container</var> is the <a>document element</a> of a <a>nested browsing context</a> then:
10651073
1. Set <var>searchOrigin</var> to <var>container</var>'s <a>browsing context container</a>
10661074
2. Set <var>eventTarget</var> be <var>searchOrigin</var>
1067-
3. Set <var>container</var> to the nearest ancestor of <var>searchOrigin</var> that is a <a>spatial navigation container</a>.
1075+
3. Set <var>container</var> to the nearest ancestor of <var>eventTarget</var> that is a <a>spatial navigation container</a>.
10681076
4. Return to the step labeled <i>loop</i>.
10691077
* Else, set <var>container</var> to its closest ancestor that is itself a <a>spatial navigation container</a>
10701078
and return to the step labeled <i>loop</i>.
10711079
</ul>
10721080
8. Let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a>
1073-
within <var>candidates</var> in <var>direction</var> starting from <var>searchOrigin</var>.
1074-
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
1075-
<span class=api><a>fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
1076-
* {{NavigationEvent/dir}} set to <var>direction</var>
1077-
* {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
1078-
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
1079-
1080-
and return if the result is <code>false</code>.</span>
1081+
within <var>candidates</var> in <var>direction</var> starting from <var>eventTarget</var>.
1082+
9. <a>Dispatches navnotarget event</a> at <var>eventTarget</var> with <var>direction</var> and <var>bestCandidate</var>.
10811083
10. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return.
10821084

10831085
</div>

0 commit comments

Comments
 (0)