Skip to content

Commit ee70dd8

Browse files
author
Jihye Hong
committed
[css-nav-1] Tweak description of the example
1 parent f6690c8 commit ee70dd8

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

css-nav-1/Overview.bs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ the User Agent must run the steps described below:
547547
5. If <var>insideFirst</var> is <code>true</code>,
548548
then let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a> within element with <var>direction</var>.
549549
* If <var>bestCandidate</var> is not <code>null</code>, return <var>bestCandidate</var>.
550-
* Else, fallback to the next step.
550+
* Else, fall back to the next step.
551551
6. Return the result of <a>selecting the best candidate</a> within <var>areas</var> in <var>direction</var> from the element.
552552

553553
Note: When neither a container nor a list of candidates is provided,
@@ -625,29 +625,33 @@ and the result will be <code>null</code>.</em>
625625
</div>
626626

627627
<div class=example id=searchInside>
628-
This example shows how the different result of {{Element/spatialNavigationSearch()}}
628+
This example shows different results of {{Element/spatialNavigationSearch()}}
629629
depending on the value of {{SpatialNavigationSearchOptions/inside}} attribute.
630630

631631
When the page has the code snippet as below,
632632

633633
<pre><code highlight=markup>
634634
&lt;body>
635-
&lt;div id="container" style="width:300px; height:200px; overflow-x: scroll;">
636-
&lt;button id="button1">&lt;/button>
635+
&lt;div id="container" style="width:300px; height:200px; overflow-y: scroll;">
636+
&lt;button id="button1" style = "width:50px; height:50px;">&lt;/button>
637637
&lt;/div>
638-
&lt;button id="button2">&lt;/button>
638+
&lt;button id="button2" style = "width:50px; height:50px;">&lt;/button>
639639
&lt;/body>
640640
</code></pre>
641641

642642
<pre><code highlight=javascript>
643643
const container = document.getElementById('container');
644644

645-
const insideBtn = container.spatialNavigationSearch('right', {inside: true});
646-
const outsideBtn = container.spatialNavigationSearch('right');
645+
const innerBtn = container.spatialNavigationSearch('down', {inside: true});
646+
const outerBtn = container.spatialNavigationSearch('down');
647647
</code></pre>
648648

649-
<code>insideBtn</code> is assigned to the element whose {{Element/id}} matches with <code>'button1'</code>.
650-
But <code>outsideBtn</code> is the element with {{Element/id}} <code>'button2'</code>.
649+
<code>innerBtn</code> is assigned to the element whose {{Element/id}} matches with <code>'button1'</code>
650+
because the {{SpatialNavigationSearchOptions/inside}} attribute is <code>true</code>.
651+
But if the authors don't specify {{SpatialNavigationSearchOptions/inside}} attribute,
652+
<code>false</code> is given to it by default.
653+
Therefore <code>outerBtn</code> is assigned to the element with {{Element/id}} <code>'button2'</code>
654+
which is outside of <code>container</code>.
651655
</div>
652656

653657
<div class=api>
@@ -1019,8 +1023,8 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
10191023
<span class=cssapi>* Else if the computed value of the 'spatial-navigation-action' property on <var>eventTarget</var> is not ''spatial-navigation-action/focus''
10201024
and <var>eventTarget</var> <a>can be manually scrolled</a>,
10211025
then <a>directionally scroll the element</a> <var>eventTarget</var> in <var>direction</var> and return.</span>
1022-
* Else, fallback to the next step.
1023-
* Else, fallback to the next step.
1026+
* Else, fall back to the next step.
1027+
* Else, fall back to the next step.
10241028
5. Let <var>container</var> be the nearest ancestor of <var>eventTarget</var> that is a <a>spatial navigation container</a>.
10251029
6. <i>Loop</i>: Let <var>candidates</var> be the result of <a>finding focusable areas</a>
10261030
within <var>container</var>

0 commit comments

Comments
 (0)