@enact/spotlight 4.0.8 → 4.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +2 -2
- package/src/container.js +12 -9
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/spotlight",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
4
4
|
"description": "A focus management library",
|
|
5
5
|
"main": "src/spotlight.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@enact/core": "^4.0.
|
|
21
|
+
"@enact/core": "^4.0.9",
|
|
22
22
|
"classnames": "^2.2.6",
|
|
23
23
|
"prop-types": "^15.7.2",
|
|
24
24
|
"ramda": "^0.24.1",
|
package/src/container.js
CHANGED
|
@@ -725,9 +725,8 @@ var getAllContainerIds = function getAllContainerIds() {
|
|
|
725
725
|
/**
|
|
726
726
|
* Returns the default focus element for a container
|
|
727
727
|
*
|
|
728
|
-
* @param {String}
|
|
729
|
-
* @param {('last-focused'|'default-element')} [preferredEnterTo] Prefer the given enterTo
|
|
730
|
-
* configuration
|
|
728
|
+
* @param {String} containerId Container ID
|
|
729
|
+
* @param {('last-focused'|'default-element'|'topmost')} [preferredEnterTo] Prefer the given enterTo configuration
|
|
731
730
|
*
|
|
732
731
|
* @returns {Node|null} Default focus element
|
|
733
732
|
* @memberof spotlight/container
|
|
@@ -831,9 +830,8 @@ function setContainerLastFocusedElement(node, containerIds) {
|
|
|
831
830
|
* return that element as the only element in an array. If that fails or if navigation is not
|
|
832
831
|
* restricted, it will return an array of all possible navigable nodes.
|
|
833
832
|
*
|
|
834
|
-
* @param {String}
|
|
835
|
-
* @param {('last-focused'|'default-element')} [preferredEnterTo] Prefer the given enterTo
|
|
836
|
-
* configuration
|
|
833
|
+
* @param {String} containerId Container ID
|
|
834
|
+
* @param {('last-focused'|'default-element'|'topmost')} [preferredEnterTo] Prefer the given enterTo configuration
|
|
837
835
|
*
|
|
838
836
|
* @returns {Node[]} Navigable elements within container
|
|
839
837
|
* @memberof spotlight/container
|
|
@@ -877,6 +875,12 @@ function getContainerNavigableElements(containerId, preferredEnterTo) {
|
|
|
877
875
|
|
|
878
876
|
return (0, _utils.contains)(containerRect, (0, _utils.getRect)(element));
|
|
879
877
|
});
|
|
878
|
+
|
|
879
|
+
if (next && preferredEnterTo === 'topmost') {
|
|
880
|
+
next.sort(function (a, b) {
|
|
881
|
+
return (0, _utils.getRect)(a).top - (0, _utils.getRect)(b).top;
|
|
882
|
+
});
|
|
883
|
+
}
|
|
880
884
|
} // otherwise, return all spottables within the container
|
|
881
885
|
|
|
882
886
|
|
|
@@ -891,9 +895,8 @@ function getContainerNavigableElements(containerId, preferredEnterTo) {
|
|
|
891
895
|
* Determines the preferred focus target, traversing any sub-containers as necessary, for the given
|
|
892
896
|
* container.
|
|
893
897
|
*
|
|
894
|
-
* @param {String}
|
|
895
|
-
* @param {('last-focused'|'default-element')} [preferredEnterTo] Prefer the given enterTo
|
|
896
|
-
* configuration
|
|
898
|
+
* @param {String} containerId Container ID
|
|
899
|
+
* @param {('last-focused'|'default-element'|'topmost')} [preferredEnterTo] Prefer the given enterTo configuration
|
|
897
900
|
*
|
|
898
901
|
* @returns {Node} Preferred target as either a DOM node or container-id
|
|
899
902
|
* @memberof spotlight/container
|