Skip to content

Commit 81da322

Browse files
committed
[css-nav-1] Editorial and gramatical fix-ups
1 parent 7c04aae commit 81da322

1 file changed

Lines changed: 69 additions & 68 deletions

File tree

css-nav-1/Overview.bs

Lines changed: 69 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -183,40 +183,36 @@ or scroll if there is no appropriate item.
183183
More specifically,
184184
the User Agent will first search for visible and focusable items
185185
in the direction indicated
186-
within the current <a>spatial navigation focus container</a>
186+
within the current <a>spatial navigation container</a>
187187
(<span class=cssapi>by default </span>the root element, scrollable elements, and iframes<span class=cssapi>,
188-
but other elements can be made into <a>spatial navigation focus containers</a>
188+
but other elements can be made into <a>spatial navigation containers</a>
189189
using the 'spatial-navigation-contain' property</span>).
190190

191191
If it finds any, it will pick the best one for that direction,
192192
and move the focus there.
193193

194-
If it does not, it will scroll the <a>spatial navigation focus container</a> in the requested direction
194+
If it does not, it will scroll the <a>spatial navigation container</a> in the requested direction
195195
instead of moving focus.
196196
Doing so may uncover focusable elements
197197
which would then be eligible targets to move the focus to
198198
next time spatial navigation in the same direction is requested.
199199

200-
If the <a>spatial navigation focus container</a> cannot be scrolled,
200+
If the <a>spatial navigation container</a> cannot be scrolled,
201201
either because it is not a scrollable element
202202
or because it is already scrolled to the maximum in that direction,
203-
the User Agent will select the next <a>spatial navigation focus container</a> up the ancestry chain.
203+
the User Agent will select the next <a>spatial navigation container</a> up the ancestry chain,
204+
and recursively repeat the above process
205+
until it finds some element to focus or scroll,
206+
or reaches the root element.
204207

205-
The process of looking for an eligible focus target and
206-
if there is any, then move the focus,
207-
else if the <a>spatial navigation focus container</a> can be scrolled, then scroll,
208-
otherwise, going up to the next container
209-
is repeated until the ancestry chain reaches the root element.
210-
211-
<div class=note>
212-
NOTE: As a consequence of this processing model,
208+
Note: As a consequence of this processing model,
213209
the elements that are reachable by sequential navigation
214-
and by spatial navigation are almost the same:
215-
* Elements that are currently outside of the viewport of a scrollable element
216-
can only be reached once they have been scrolled into view
217-
* Elements that cannot be scrolled into view.
218-
For instance, those are out of reach because they are placed at a negative offset.
219-
</div>
210+
and by spatial navigation are almost the same.
211+
Elements that are currently outside of the viewport of a scrollable element
212+
can only be reached by spatial navigation once they have been scrolled into view.
213+
Therefore, elements that cannot be scrolled into view
214+
(for example because they are placed at a negative offset)
215+
cannot be reached by spatial navigation.
220216

221217
<div class=api>
222218
At key points during this search for the appropriate response to the spatial navigation request,
@@ -239,7 +235,7 @@ and [[#declarative]] for details about the CSS properties.
239235
</div>
240236

241237
<div class='example'>
242-
In this example, shows how a series of focusable elements
238+
This example shows how a series of focusable elements
243239
arranged in a scrollable element
244240
would be navigated when using spatial navigation.
245241
For the sake of keeping the description simple,
@@ -248,19 +244,19 @@ and [[#declarative]] for details about the CSS properties.
248244
<figure>
249245
<img alt="" src="images/spatnav-scroll-visible-1.png" style="width: 200px;"/>
250246
<img alt="" src="images/spatnav-scroll-visible-2.png" style="width: 200px;"/>
251-
<figcaption>Moving focus to the visible element in the <a>spatial navigation focus container</a>.</figcaption>
247+
<figcaption>Moving focus to the visible element in the <a>spatial navigation container</a>.</figcaption>
252248
</figure>
253249

254250
On the left of figure 2, "Box 2" is focused.
255251
Pressing the <code class=key>ArrowDown</code> key moves the focus to
256-
"Box 3" without scrolling because "Box 3" is visible in the <a>scrollport</a> of the <a>spatial navigation focus container</a>.
252+
"Box 3" without scrolling because "Box 3" is visible in the <a>scrollport</a> of the <a>spatial navigation container</a>.
257253

258254
<figure>
259255
<img alt="" src="images/spatnav-scroll-invisible-1.png" style="width: 160px;"/>
260256
<img alt="" src="images/spatnav-scroll-invisible-2.png" style="width: 160px;"/>
261257
<img alt="" src="images/spatnav-scroll-invisible-3.png" style="width: 160px;"/>
262258
<img alt="" src="images/spatnav-scroll-invisible-4.png" style="width: 160px;"/>
263-
<figcaption>Moving focus to the hidden element in the <a>spatial navigation focus container</a>.</figcaption>
259+
<figcaption>Moving focus to the hidden element in the <a>spatial navigation container</a>.</figcaption>
264260
</figure>
265261

266262
On the first of figure 3, under "Box 3", there isn't any visible element in the <a>scrollport</a>.
@@ -311,7 +307,7 @@ This intentionally left for User Agents to decide.
311307
<div class=note>Note:
312308
It is expected that User Agents on devices with limited input capabilities,
313309
such as TVs operated with a remote control,
314-
or smart feature phones,
310+
feature phones,
315311
or devices operated with a game controller,
316312
will use spatial navigation as their primary or exclusive navigation mechanism.
317313
</div>
@@ -330,8 +326,8 @@ even if the author has not invoked any of the APIs.
330326
Regardless of the actual mechanism chosen to trigger spatial navigation,
331327
the following requirements apply:
332328
* If the mechanism the user must use to trigger spatial navigation
333-
would normally fire a {{UIEvent}}.
334-
The event must be fired prior to running the <a>spatial navigation steps</a>
329+
would normally fire a {{UIEvent}},
330+
the event must be fired prior to running the <a>spatial navigation steps</a>
335331
and these steps must not be run if that event's <a>canceled flag</a>
336332
gets set.
337333

@@ -351,8 +347,8 @@ the following requirements apply:
351347
would follow the same sequence.
352348
</div>
353349
* If the mechanism the user must use to trigger spatial navigation
354-
would trigger other actions in some contexts.
355-
The User Agent should in these contexts
350+
would trigger other actions in some contexts,
351+
the User Agent should in these contexts
356352
give priority to these other actions
357353
and execute them instead of spatial navigation.
358354
It must not trigger both.
@@ -406,8 +402,8 @@ the same chain of events will be fired and
406402
the same element will be scrolled or focused.
407403

408404
Note: Authors can use this to trigger spatial navigation
409-
based on a different UI mechanism than the one assigned by the User Agent.
410-
Such as mapping to different keys,
405+
based on a different UI mechanism than the one assigned by the User Agent,
406+
such as mapping to different keys,
411407
or triggering spatial navigation from a clickable on-screen directional pad,
412408
or in reaction to other events than UI ones.
413409
It could also be used when an author wants to interrupt navigation to do some asynchronous operation
@@ -475,9 +471,12 @@ More directional keywords or a numerical angle could be added.
475471

476472
Note: the {{focusableAreas()}} and {{getSpatialNavigationContainer()}} methods are <a>at-risk</a>.
477473

474+
When these methods are called,
475+
the User Agent must run the steps described below:
476+
478477
<div algorithm="getSpatialNavigationContainer steps">
479478
: <dfn method for=Element lt="getSpatialNavigationContainer()">{{Element/getSpatialNavigationContainer()}}</dfn>
480-
:: Follows these steps:
479+
::
481480
1. Return the element if it is a <a>spatial navigation container</a>,
482481
or the nearest ancestor of the element that is a <a>spatial navigation container</a>,
483482
or the <a>document</a> if the nearest <a>spatial navigation container</a> is the viewport.
@@ -486,11 +485,11 @@ Note: the {{focusableAreas()}} and {{getSpatialNavigationContainer()}} methods a
486485

487486
<div algorithm="focusableAreas steps">
488487
: <dfn method for=Element lt="focusableAreas(option)">focusableAreas(<var>option</var>)</dfn>
489-
:: Follows these steps:
488+
::
490489
1. Let <var>visibleOnly</var> be <code>false</code>
491490
if <var>option</var> is present and its value is equal to <code>'all'</code>,
492491
or <code>true</code> otherwise.
493-
2. Let <var>areas</var> be the result of <a>finding focusable areas</a> within the element with the <var>visibleOnly</var>.
492+
2. Let <var>areas</var> be the result of <a>finding focusable areas</a> within the element with <var>visibleOnly</var> as argument.
494493
3. Let <var>anchors</var> be a <a for=list>clone</a> of <var>areas</var>,
495494
with every <a>focusable area</a> which is not itself a <a>Node</a> replaced with its <a>DOM anchor</a>.
496495
4. Return <var>anchors</var>
@@ -500,7 +499,7 @@ Note: the {{focusableAreas()}} and {{getSpatialNavigationContainer()}} methods a
500499
<div class=example id=focusAreas-visible>
501500
The following code shows how to get all the visible focusable elements in the current page using {{Element/focusableAreas()}}.
502501
If the method finds a <a>spatial navigation container</a>, it recursively finds focusable areas inside it.
503-
However, <code>visible</code> is given to the {{FocusableAreasOptions/mode}} attribute of this method,
502+
However, as the {{FocusableAreasOptions/mode}} attribute of this method is set to <code>visible</code>,
504503
the focusable element which isn’t inside the <a>scrollport</a> is excluded from the result.
505504

506505
<pre><code highlight=markup>
@@ -528,28 +527,32 @@ Note: the {{focusableAreas()}} and {{getSpatialNavigationContainer()}} methods a
528527

529528
<div algorithm="spatialNavigationSearch steps">
530529
: <dfn method for=Element lt="spatialNavigationSearch(options)">spatialNavigationSearch(<var>options</var>)</dfn>
531-
:: Follows these steps:
532-
1. Let <var>direction</var> be the value of {{SpatialNavigationSearchOptions/dir}} attribute from <var>options</var>.
533-
2. If the value of {{SpatialNavigationSearchOptions/candidates}} attribute from <var>options</var> is not <code>null</code>,
534-
then let <var>areas</var> be the corresponding value.
535-
3. Else, let <var>container</var> be
536-
* the value of {{SpatialNavigationSearchOptions/container}} attribute from <var>options</var>, if it is not <code>null</code>,
537-
* the element's nearest <a>spatial navigation container</a> ancestor, otherwise.
538-
4. Let <var>areas</var> be the result of <a>finding focusable areas</a> within <var>container</var>.
539-
5. Return the result of <a>selecting the best candidate</a> within <var>areas</var> in direction <var>direction</var> from the element.
530+
::
531+
1. Let <var>direction</var> be the value of {{SpatialNavigationSearchOptions/dir}} attribute of <var>options</var>.
532+
2.
533+
* If the value of {{SpatialNavigationSearchOptions/candidates}} attribute of <var>options</var> is not <code>null</code>,
534+
then let <var>areas</var> be the that value
535+
* else,
536+
1.
537+
* If the value of {{SpatialNavigationSearchOptions/container}} attribute of <var>options</var> is not <code>null</code>,
538+
let <var>container</var> be that value
539+
* else, let <var>container</var> be the element's nearest <a>spatial navigation container</a> ancestor.
540+
2. Let <var>areas</var> be the result of <a>finding focusable areas</a> within <var>container</var>.
541+
3. Return the result of <a>selecting the best candidate</a> within <var>areas</var> in direction <var>direction</var> from the element.
540542

541543
Note: When neither a container nor a list of candidates is provided,
542544
this only searches through the visible focusable areas of the nearest
543545
<a>spatial navigation container</a> ancestor.
544-
<strong>If there isn't any eligible element to navigate, this does not climb further up the ancestry chain,
545-
and the result will be <code>null</code>.</strong>
546+
<em>If there isn't any, this does not climb further up the ancestry chain,
547+
and the result will be <code>null</code>.</em>
546548
</div>
547549

548550
<div class=example id=delegation>
549551
The following code changes the behavior of spatial navigation
550552
so that when a scroll container would get focused,
551553
if it has at least one visible focusable descendant,
552-
the focus is automatically transferred to it.
554+
the focus is automatically transferred to it,
555+
recursively.
553556

554557
<pre><code highlight=javascript>
555558
document.addEventListener('navbeforefocus', function(e) {
@@ -581,7 +584,7 @@ and the result will be <code>null</code>.</strong>
581584

582585
However, the focus can still be moved outside by sequential navigation,
583586
mouse interaction,
584-
and programmatic calls to {{focus()}}
587+
or programmatic calls to {{focus()}}
585588

586589
<pre><code highlight=javascript>
587590
document.addEventListener('navnotarget', function(e) {
@@ -729,10 +732,9 @@ The <a event>navbeforefocus</a> event occurs before spatial navigation changes t
729732

730733
The <a event>navnotarget</a> event occurs before going up the tree to search candidates in the
731734
nearest ancestor <a>spatial navigation container</a> when spatial navigation has failed to find any candidate
732-
within the current <a>spatial navigation container</a>.
733-
734-
If the <a>spatial navigation container</a> is scrollable, the event occurs when there isn't any candidate in it
735-
and it cannot be scrolled at the same time.
735+
within the current <a>spatial navigation container</a>,
736+
and in cases where the <a>spatial navigation container</a> is scrollable,
737+
when it cannot be scrolled further.
736738

737739
<table class="def">
738740
<tbody>
@@ -924,9 +926,9 @@ from a local logical grouping,
924926
only looking for focusable elements outside of the grouping
925927
if a suitable one cannot be found inside it (see [[#nav]] for details).
926928

927-
Such groupings are called <dfn lt="spatial navigation focus container | spatial navigation focus containers | spatial navigation container | spatial navigation containers">spatial navigation focus containers</dfn>.
929+
Such groupings are called <dfn>spatial navigation containers</dfn>.
928930

929-
<span class=cssapi>By default, </span><a>spatial navigation containers</a>(same with spatial navigation focus container) are established by:
931+
<span class=cssapi>By default, </span><a>spatial navigation containers</a> are established by:
930932
* The viewport of a <a for="/">browsing context</a>
931933
(not limited to the <a>top-level browsing context</a>)
932934

@@ -977,9 +979,9 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
977979
within <var>candidates</var> in <var>direction</var> starting from <var>searchOrigin</var>
978980
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
979981
<span class=api><a>fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
980-
* Set {{NavigationEvent/dir}} to <var>direction</var>
981-
* Set {{NavigationEvent/relatedTarget}} to <var>bestCandidate</var>
982-
* Set <code>bubbles</code> and <code>cancelable</code> attributes to <code>true</code>
982+
* {{NavigationEvent/dir}} set to <var>direction</var>
983+
* {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
984+
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
983985

984986
and return if the result is <code>false</code>.</span>
985987
3. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return
@@ -995,9 +997,9 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
995997
* Else,
996998
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
997999
<span class=api><a>fire an event</a> named <a event>navnotarget</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
998-
* Set {{NavigationEvent/dir}} to <var>direction</var>
999-
* Set {{NavigationEvent/relatedTarget}} to <var>container</var>
1000-
* Set <code>bubbles</code> and <code>cancelable</code> attributes to <code>true</code>
1000+
* {{NavigationEvent/dir}} set to <var>direction</var>
1001+
* {{NavigationEvent/relatedTarget}} set to <var>container</var>
1002+
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
10011003

10021004
and return if the result is <code>false</code>.</span>
10031005
2.
@@ -1015,9 +1017,9 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
10151017
within <var>candidates</var> in <var>direction</var> starting from <var>searchOrigin</var>.
10161018
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
10171019
<span class=api><a>fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}} with:
1018-
* Set {{NavigationEvent/dir}} to <var>direction</var>
1019-
* Set {{NavigationEvent/relatedTarget}} to <var>bestCandidate</var>
1020-
* Set <code>bubbles</code> and <code>cancelable</code> attributes to <code>true</code>
1020+
* {{NavigationEvent/dir}} set to <var>direction</var>
1021+
* {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
1022+
* the <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>
10211023

10221024
and return if the result is <code>false</code>.</span>
10231025
11. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return.
@@ -1246,16 +1248,16 @@ Inherited: no
12461248
<dl dfn-for=spatial-navigation-contain dfn-type=value>
12471249
<dt><dfn>auto</dfn>
12481250
<dd>If the element is a <a>scroll container</a>
1249-
then it establishes a <a>spatial navigation focus container</a>,
1251+
then it establishes a <a>spatial navigation container</a>,
12501252
otherwise it does not.
12511253

12521254
<dt><dfn>contain</dfn>
1253-
<dd>The element establishes a <a>spatial navigation focus container</a>
1255+
<dd>The element establishes a <a>spatial navigation container</a>
12541256
</dl>
12551257

12561258
Note: In addition, as per [[#grouping]], the viewport of a <a for="/">browsing context</a>
12571259
(not limited to the <a>top-level browsing context</a>)
1258-
also establishes a <a>spatial navigation focus container</a>.
1260+
also establishes a <a>spatial navigation container</a>.
12591261

12601262
<div class=example>
12611263
The following example shows a simplified TV program schedule or calendar.
@@ -1352,14 +1354,13 @@ Note: the 'spatial-navigation-contain' property is <a>at-risk</a>.
13521354
</div>
13531355

13541356
<h3 id=css-property-spatialnavigationaction>
1355-
Defining the spatial navigation behavior : the 'spatial-navigation-action' property</h3>
1357+
Controlling the interaction with scrolling: the 'spatial-navigation-action' property</h3>
13561358

13571359
<pre class='propdef'>
13581360
Name: spatial-navigation-action
13591361
Value: auto | focus | scroll
13601362
Initial: auto
1361-
Applies to: <a>scroll container</a>
1362-
Inherited: true
1363+
Applies to: <a>scroll containers</a>
13631364
</pre>
13641365

13651366
When the user triggers spatial navigation in a given direction, the 'spatial-navigation-action' decides

0 commit comments

Comments
 (0)