@@ -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
646647partial 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
6786814. 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:
6956931. Let <var> d</var> be the argument
6966942. 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