You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove using the enter key to navigate inside scrollers
Instead, navigating down (resp. up, left, right) when
a scroller is focused will automatically chose between
* focusing the child nearest from the edge in that direction
if there is any focusable child
* scrolling otherwise
This also removes much of the special casing needed for the root.
Some ambiguities / inacuracies were resolved along the way.
Closesw3c#15Closesw3c#18
Partly relates to w3c#29
var areas = container.focusableAreas({ mode: "all" });
467
447
468
448
if (areas.length == 0)) { return; }
@@ -495,7 +475,6 @@ enum NavigationDirection {
495
475
"down",
496
476
"left",
497
477
"right",
498
-
"inside",
499
478
"forward",
500
479
"backward"
501
480
};
@@ -874,11 +853,10 @@ if a suitable one cannot be found inside it (see [[#nav]] for details).
874
853
Such groupings are called <dfn lt="spatial navigation focus container | spatial navigation focus containers | spatnav container | spatnav containers">spatial navigation focus containers</dfn> (or <strong>spatnav containers</strong> for short).
875
854
876
855
By default, <a>spatnav containers</a> are established by:
877
-
* the <a>document element</a>of a <a for="/">browsing context</a>'s <a>document</a>
856
+
* The viewport of a <a for="/">browsing context</a>
878
857
(not limited to the <a>top-level browsing context</a>)
879
858
880
-
Issue(18): Should that be the viewport rather than the document element?
881
-
* a <a>scroll containers</a>
859
+
* <a>scroll containers</a>
882
860
883
861
Additional <a>spatnav containers</a> can be created using the 'spatial-navigation-contain' property (see [[#container]]).
884
862
@@ -899,27 +877,40 @@ Issue(23): The focusing steps should probably reset the <a>spatial navigation st
899
877
To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the following:
900
878
901
879
1. Let <var>startingPoint</var> be the <a>DOM anchor</a> of the <a>currently focused area of a top-level browsing context</a>.
902
-
2. If <var>startingPoint</var> is the <a>Document</a> of the <a>top-level browsing context</a>
903
-
set <var>startingPoint</var> to <a>the body element</a> if it is not <code>null</code>
904
-
or to the <a>document element</a> otherwise.
905
-
3. If the <a>spatial navigation starting point</a> is not <code>null</code>
906
-
and it is a descendant of <var>startingPoint</var>
880
+
2. If the <a>spatial navigation starting point</a> is not <code>null</code>
881
+
and it is inside <var>startingPoint</var>
907
882
then set <var>startingPoint</var> to the <a>spatial navigation starting point</a>
908
-
4. If the <var>direction</var> is <code>inside</code>,
909
-
then run the <a>navigate inside steps</a> on <var>startingPoint</var>.
910
-
1. Let <var>eventTarget</var> be <var>startingPoint</var> if <var>startingPoint</var> is an element,
911
-
or let <var>eventTarget</var> be the element which contains <var>startingPoint</var>
912
-
if <var>startingPoint</var> is a position.
913
-
(<a>assert</a>: There is no other alternative)
914
-
2. If <var>starting point</var> is the <a>document element</a> or the <a>the body element</a> of the <a>top-level browsing context</a>
915
-
then set <var>starting point</var> to:
916
-
* the top edge of the viewport if <var>direction</var> is <code>down</code>
917
-
* the bottom edge of the viewport if <var>direction</var> is <code>up</code>
918
-
* the left edge of the viewport if <var>direction</var> is <code>right</code>
919
-
* the right edge of the viewport if <var>direction</var> is <code>left</code>
920
-
921
-
Note: We special case the situation where we're navigating from the state where nothing was focused,
922
-
to start searching from the edges of the viewport.
883
+
4.
884
+
* If <var>startingPoint</var> is an <a>node</a>,
885
+
let <var>eventTarget</var> be <var>startingPoint</var>
886
+
* else (<a>assert</a>: the starting point is a position)
887
+
let <var>eventTarget</var> be the <a>node</a> which contains <var>startingPoint</var>
888
+
5. If <var>eventTarget</var> is the <a>Document</a> or the <a>document element</a>,
889
+
set <var>eventTarget</var> be <a>the body element</a> if it is not <code>null</code>
890
+
or to the <a>document element</a> otherwise.
891
+
5. If <var>startingPoint</var> is either a <a>scroll container</a> or the <a>document</a>
892
+
1. Let <var>candidates</var> be the result of <a>finding focusable areas</a>
893
+
within <var>startingPoint</var>
894
+
2.
895
+
* If <var>candidates</var> contains at least 1 item
896
+
1. Let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a>
897
+
within <var>candidates</var> in <var>direction</var> starting from <var>startingPoint</var>
898
+
2. <a>Fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}}
899
+
with its {{NavigationEvent/dir}} set to <var>direction</var> and {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
900
+
and with it's <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>,
901
+
and let <var>allowFocusChange</var> be the result.
902
+
3. If <var>allowFocusChange</var> is <code>false</code>, return
903
+
4. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return
904
+
* Else if <var>eventTarget</var><a>can be manually scrolled</a>
905
+
1. <a>Fire an event</a> named <a event>navbeforescroll</a> at <var>eventTarget</var> using {{NavigationEvent}}
906
+
with its {{NavigationEvent/dir}} set to <var>direction</var>
907
+
and {{NavigationEvent/relatedTarget}} set to <var>eventTarget</var>
908
+
and with it's <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>,
909
+
and let <var>allowScroll</var> be the result.
910
+
2. If <var>allowScroll</var> is <code>true</code>,
911
+
then <a>Directionally scroll the element</a><var>eventTarget</var> in <var>direction</var> and return,
912
+
else return.
913
+
* Else, fallback to the next step
923
914
3. Let <var>container</var> be the nearest ancestor of <var>eventTarget</var> that is a <a>spatnav container</a>.
924
915
4. <i>Loop</i>: Let <var>candidates</var> be the result of <a>finding focusable areas</a>
925
916
within <var>container</var>
@@ -931,7 +922,7 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
931
922
and with it's <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>,
932
923
and let <var>allowScroll</var> be the result.
933
924
2. If <var>allowScroll</var> is <code>true</code>,
934
-
then return <a>Directionally scroll the element</a><var>container</var> in <var>direction</var>the return,
925
+
then <a>Directionally scroll the element</a><var>container</var> in <var>direction</var>and return,
935
926
else return.
936
927
* Else,
937
928
1. <a>Fire an event</a> named <a event>navnotarget</a> at <var>eventTarget</var> using {{NavigationEvent}}
@@ -962,27 +953,6 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
962
953
963
954
</div>
964
955
965
-
<div algorithm="to run the navigate inside steps">
966
-
To run the <dfn>navigate inside steps</dfn> on <var>eventTarget</var>, do the following:
967
-
1. Let <var>candidates</var> be the result of <a>finding focusable areas</a>
968
-
within <var>eventTarget</var>
969
-
2. If <var>candidates</var> is <code>null</code>,
970
-
<a>Fire an event</a> named <a event>navnotarget</a> at <var>eventTarget</var> using {{NavigationEvent}}
971
-
with its {{NavigationEvent/dir}} set to <code>inside</code> and {{NavigationEvent/relatedTarget}} set to <var>eventTarget</var>
972
-
and with it's <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>,
973
-
then return.
974
-
3. Let <var>bestCandidate</var> be the result of <a>selecting the best candidate</a>
975
-
within <var>candidates</var> in direction <code>inside</code>
976
-
starting from the <a>inline start</a><a>block start</a> corner of <var>eventTarget</var>'s <a>scrollport</a>.
977
-
4. <a>Fire an event</a> named <a event>navbeforefocus</a> at <var>eventTarget</var> using {{NavigationEvent}}
978
-
with its {{NavigationEvent/dir}} set to <code>inside</code> and {{NavigationEvent/relatedTarget}} set to <var>bestCandidate</var>
979
-
and with it's <code>bubbles</code> and <code>cancelable</code> attributes set to <code>true</code>,
980
-
and let <var>allowFocusChange</var> be the result.
981
-
5. If <var>allowFocusChange</var> is <code>false</code>, return
982
-
6. Run the <a>focusing steps</a> for <var>bestCandidate</var> and return
983
-
984
-
</div>
985
-
986
956
For consistency between <a>sequential focus navigation</a> and the model defined above,
987
957
the following is also defined:
988
958
@@ -1018,10 +988,9 @@ All geometrical operations in this section are defined to work on the result of
1018
988
including all graphical transformations, such as <a>relative positioning</a> or [[CSS-TRANSFORMS-1]].
1019
989
1020
990
The <dfn>boundary box</dfn> of an object is defined as follows:
1021
-
* if the object is a point, the boundary is that point
1022
-
* if the object is an element, the boundary is the <a>border box</a> of the element's <a>principal box</a>.
1023
-
* if the object is a <a>focusable area</a> which is not an element, the boundary is the axis-aligned the bounding box of that <a>focusable area</a>
1024
-
* if the object is a geometric shape, the boundary is the axis-aligned the bounding box of that shape
991
+
* if the object is a point, the boundary box is that point
992
+
* if the object is an element, the boundary box is the <a>border box</a> of the element's <a>principal box</a>.
993
+
* if the object is a <a>focusable area</a> which is not an element, the boundary box is the axis-aligned the bounding box of that <a>focusable area</a>
1025
994
1026
995
Issue(w3c/csswg-drafts#2324): CSS should have a term for “border box taking into account corner shaping properties like border-radius”.
1027
996
@@ -1040,12 +1009,16 @@ follow the following steps:
1040
1009
return <var>focusables</var>.
1041
1010
1042
1011
Note: <var>focusables</var> may be empty
1012
+
3. Let <var>insideArea</var> be
1013
+
* the <a>optimal viewing region</a> of <var>C</var> if <var>C</var> is a <a>scroll container</a>,
1014
+
1015
+
Issue(29): Should that be C's <a>optimal viewing region</a> or <a>scrollport</a>?
1016
+
1017
+
* the viewport of C's <a for="/">browsing context</a> if <var>C</var> is a <a>Document</a>,
1018
+
* the <a>border box</a> of <var>C</var> otherwise.
1043
1019
3. Let <var>visibles</var> be the subset of items in <var>focusables</var>
1044
1020
whose <a>boundary box</a>
1045
-
is at least partly within <var>C</var>'s <a>scrollport</a>.
1046
-
1047
-
Issue(29): Should that be C's <a>optimal viewing region</a> instead?
1048
-
Probably not, given the next step, but maybe.
1021
+
is at least partly within <var>insideArea</var>.
1049
1022
4. Remove from <var>visibles</var> items are <a>obscured</a> by other parts of the page:
1050
1023
If no point of the area enclosed by an item's <a>boundary box</a> can be hit by a hit test due to some other object(s) overlapping it,
1051
1024
it is said to be <dfn>obscured</dfn>.
@@ -1080,36 +1053,58 @@ follow the following steps:
1080
1053
1081
1054
1. If <var>candidates</var> is <a spec=infra for=set>empty</a>, return <code>null</code>
1082
1055
2. If <var>candidates</var> contains a single item, return that item
1083
-
3. If <var>dir</var> is not <code>inside</code>,
1084
-
set <var>candidates</var> be the subset of its items
1085
-
whose <a>boundary box</a>'s geometric center is within the closed half plane
1086
-
whose boundary goes through the geometric center of the <var>starting point</var>
1087
-
and is perpendicular to <var>D</var>.
1088
-
3. For each <var>candidate</var> in <var>candidates</var>,
1089
-
find the points <var>P1</var> inside the <a>boundary box</a> of <var>starting point</var>
1090
-
and <var>P2</var> inside the <a>boundary box</a> of <var>candidate</var>
1091
-
that minimize the <var>distance</var> between these two points,
0 commit comments