diff --git a/index.bs b/index.bs index 4ac6d279..9b307b30 100644 --- a/index.bs +++ b/index.bs @@ -629,9 +629,10 @@ enum SpatialNavigationDirection { "inside" }; -dictionary FindSpatNavCandidatesOptions { - required SpatialNavigationDirection dir; - Node? container; +enum FocusableAreaSearchMode { "visible", "all" }; + +dictionary FocusableAreasOptions { + FocusableAreaSearchMode mode; }; dictionary SelectSpatNavBestCandidateOptions { @@ -640,20 +641,26 @@ dictionary SelectSpatNavBestCandidateOptions { }; partial interface Element { - sequence<Node> findSpatNavCandidates(FindSpatNavCandidatesOptions arg); + Node getSpatnavContainer(); + sequence<Node> focusableAreas(optional FocusableAreasOptions arg); Node? selectSpatNavBestCandidate(SelectSpatNavBestCandidateOptions arg); Node? sequentialNavSearch(SequentialNavigationDirection dir); }; -
-The {{Element/findSpatNavCandidates()}} method must follow these steps: -1. Let d be the argument's {{FindSpatNavCandidatesOptions/dir}} attribute -2. Let c be the argument's {{FindSpatNavCandidatesOptions/container}} attribute -3. If c is null, - set c to the nearest ancestor of eventTarget that is a spatnav container. -4. Let candidates be the result of finding candidates within c in direction d starting from the element -5. Let anchors be a clone of candidates, +
+The {{Element/getSpatnavContainer()}} method must follow these steps: +1. Return the nearest ancestor of the element that is a spatnav container + +
+ +
+The {{Element/focusableAreas()}} method must follow these steps: +1. Let v be false + if the argument's {{FocusableAreasOptions/mode}} attribute if present and equal to "all", + or true otherwise. +4. Let areas be the result of finding focusable areas within the element with the visibleOnly argument set to v +5. Let anchors be a clone of areas, with every focusable area which is not itself a Node replaced with its DOM anchor. 6. Return anchors @@ -848,10 +855,8 @@ To run the spatial navigation steps in direction, do the f Note: We special case the situation where we're navigating from the state where nothing was focused, to start searching from the edges of the viewport. 3. Let container be the nearest ancestor of eventTarget that is a spatnav container. -4. Loop: Let candidates be the result of finding candidates +4. Loop: Let candidates be the result of finding focusable areas within container - in direction - starting from startingPoint 5. If candidates is null: * If container is a scroll container that can be manually scrolled: 1. Fire an event named navbeforescroll at eventTarget using {{NavigationEvent}} @@ -893,10 +898,8 @@ To run the spatial navigation steps in direction, do the f
To run the navigate inside steps on eventTarget, do the following: -1. Let candidates be the result of finding candidates +1. Let candidates be the result of finding focusable areas within eventTarget - starting from eventTarget - in direction inside 2. If candidates is null, Fire an event named navnotarget at eventTarget using {{NavigationEvent}} with its {{NavigationEvent/dir}} set to inside and {{NavigationEvent/relatedTarget}} set to eventTarget @@ -941,7 +944,7 @@ as well as from the old WIC Implementors who find better approaches or refinements to these approaches are strongly encouraged to provide feedback and help improve this specification in order to maximize interoperability. -In particular, divergences in how User Agents find candidates +In particular, divergences in how User Agents find focusable areas may cause some elements to be focusable in some User Agents but not in others, which would be bad for users. @@ -956,11 +959,10 @@ The boundary box of an object is defined as follows: Issue(w3c/csswg-drafts#2324): CSS should have a term for “border box taking into account corner shaping properties like border-radius”. -
+
-To find candidates within a containing element C, -in a direction D, -starting from starting point, +To find candidates within a containing element C, +with an optional visibleOnly argument that defaults to true, follow the following steps: 1. Let focusables be the set of all the focusable areas that are descendants of C. @@ -968,6 +970,10 @@ follow the following steps: Note: This is a "SHOULD" in order to mirror the exclusion of elements with negative tabindex from the sequential focus navigation order as defined in [[HTML#the-tabindex-attribute]]. +3. If visibleOnly is false, + return focusables. + + Note: focusables may be empty 3. Let visibles be the subset of items in focusables whose boundary box is at least partly within C's scrollport. @@ -992,16 +998,9 @@ follow the following steps: that authors forget to do so. Issue(w3c/csswg-drafts#2325): Some CSS spec needs to define hit testing. -5. - * If D is inside, - let candidates be the same as visibles - * Else, let candidates be the subset of the items in visibles - whose boundary box's geometric center is within the closed half plane - whose boundary goes through the geometric center of the starting point - and is perpendicular to D. -6. Return candidates. +5. Return visibles. - Note: candidates may be empty + Note: visibles may be empty
@@ -1015,6 +1014,11 @@ follow the following steps: 1. If candidates is empty, return null 2. If candidates contains a single item, return that item +3. If dir is not inside, + set candidates be the subset of its items + whose boundary box's geometric center is within the closed half plane + whose boundary goes through the geometric center of the starting point + and is perpendicular to D. 3. For each candidate in candidates, find the points P1 inside the boundary box of starting point and P2 inside the boundary box of candidate