Skip to content

Commit aadb72d

Browse files
committed
Change selectSpatNavBestCandidate into spatNavSearch
Improve the arguments it takes while we're at it. This closes w3c#20 and w3c#30 This relates to w3c#37 as well.
1 parent f7f41a2 commit aadb72d

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

index.bs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -638,16 +638,17 @@ dictionary FocusableAreasOptions {
638638
FocusableAreaSearchMode mode;
639639
};
640640

641-
dictionary SelectSpatNavBestCandidateOptions {
641+
dictionary SpatNavSearchOptions {
642642
required SpatialNavigationDirection dir;
643-
required sequence<Node> candidates;
643+
sequence<Node>? candidates;
644+
Node? container;
644645
};
645646

646647
partial interface Element {
647648
Node getSpatnavContainer();
648649
sequence<Node> focusableAreas(optional FocusableAreasOptions arg);
649-
Node? selectSpatNavBestCandidate(SelectSpatNavBestCandidateOptions arg);
650-
Node? sequentialNavSearch(SequentialNavigationDirection dir);
650+
Node? spatNavSearch(SpatNavSearchOptions arg);
651+
Node? seqNavSearch(SequentialNavigationDirection dir);
651652
};
652653
</pre>
653654

@@ -669,29 +670,26 @@ The {{Element/focusableAreas()}} method must follow these steps:
669670

670671
</div>
671672

672-
<div algorithm="selectSpatNavBestCandidate steps">
673-
The {{Element/selectSpatNavBestCandidate()}} method must follow these steps:
674-
1. Let <var>d</var> be the argument's {{SelectSpatNavBestCandidateOptions/dir}} attribute
675-
2. Let <var>candidates</var> be the argument's {{SelectSpatNavBestCandidateOptions/candidates}} attribute.
676-
3. Let <var>areas</var> be a <a for=list>clone</a> of <var>candidates</var>,
677-
with every item replaced by its <a>focusable area</a> if that is distinct from itself.
673+
<div algorithm="spatNavSearch steps">
674+
The {{Element/spatNavSearch()}} method must follow these steps:
675+
1. Let <var>d</var> be the argument's {{SpatNavSearchOptions/dir}} attribute
676+
2. If the argument's {{SpatNavSearchOptions/candidates}} attribute is not <code>null</code>,
677+
then let <var>areas</var> be that atribute,
678+
else, let <var>areas</var> be the result of <a>finding focusable areas</a>
679+
within the argument's {{SpatNavSearchOptions/container}} attribute is not <code>null</code>,
680+
or the element's nearest <a>spatnav container</a> ancestor
678681
4. Return the result of <a>selecting the best candidate</a> within <var>areas</var> in direction <var>d</var> from the element
679682

683+
Note: When neither a container nor a list of candidates is provided,
684+
this only searches through the visible focusable areas of the nearest
685+
<a>spatnav container</a> ancestor.
686+
<strong>If none are found, this does not climb further up the ancestry chain,
687+
and the result will be <code>null</code>.</strong>
680688
</div>
681689

682-
Issue(20): Does {{SelectSpatNavBestCandidateOptions/candidates}} need to be required?
683-
Is there a way to know the best candidate just with the direction argument?
684-
(e.g. elm.selectSpatNavBestCandidate("right");)
685-
It seems that such a shortcut would be convenient,
686-
but it may also be confusing:
687-
Would this be expected to search only within the innermost spatnav container,
688-
or to reproduce the full logic of running the <a>spatial navigation steps</a>,
689-
and if so, does that include scrolling, or a special return value to indicate
690-
that scrolling would have happened?
691-
Maybe we need a separate method for that.
692-
693-
<div algorithm="sequentialNavSearch steps">
694-
The {{Element/sequentialNavSearch()}} method must follow these steps:
690+
691+
<div algorithm="seqNavSearch steps">
692+
The {{Element/seqNavSearch()}} method must follow these steps:
695693
1. Let <var>d</var> be the argument
696694
2. Let <var>s</var> be <code>sequential</code> if the element is a <a for="/">browsing context</a>
697695
or if the element is in its <a>control group</a>'s <a>sequential focus navigation order</a>;
@@ -700,7 +698,6 @@ The {{Element/sequentialNavSearch()}} method must follow these steps:
700698
<var>d</var> as its direction argument,
701699
and <var>s</var> as the selection mechanism argument.
702700

703-
704701
</div>
705702

706703
<h2 id=processing-model>

0 commit comments

Comments
 (0)