@enact/spotlight 4.5.0-alpha.1 → 4.5.0-alpha.2
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 +6 -0
- package/package.json +2 -2
- package/src/container.js +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact spotlight module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [4.5.0-alpha.2] - 2022-05-09
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- `spotlight` to not focus on an invisible element
|
|
10
|
+
|
|
5
11
|
## [4.5.0-alpha.1] - 2022-04-15
|
|
6
12
|
|
|
7
13
|
No significant changes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/spotlight",
|
|
3
|
-
"version": "4.5.0-alpha.
|
|
3
|
+
"version": "4.5.0-alpha.2",
|
|
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.5.0-alpha.
|
|
21
|
+
"@enact/core": "^4.5.0-alpha.2",
|
|
22
22
|
"classnames": "^2.3.1",
|
|
23
23
|
"prop-types": "^15.8.1",
|
|
24
24
|
"ramda": "^0.28.0",
|
package/src/container.js
CHANGED
|
@@ -34,6 +34,8 @@ var _and = _interopRequireDefault(require("ramda/src/and"));
|
|
|
34
34
|
|
|
35
35
|
var _concat = _interopRequireDefault(require("ramda/src/concat"));
|
|
36
36
|
|
|
37
|
+
var _snapshot = require("@enact/core/snapshot");
|
|
38
|
+
|
|
37
39
|
var _util = require("@enact/core/util");
|
|
38
40
|
|
|
39
41
|
var _intersection = _interopRequireDefault(require("ramda/src/intersection"));
|
|
@@ -147,18 +149,14 @@ var GlobalConfig = {
|
|
|
147
149
|
*/
|
|
148
150
|
|
|
149
151
|
var querySelector = function querySelector(node, includeSelector, excludeSelector) {
|
|
150
|
-
var include =
|
|
152
|
+
var include = new Set(node.querySelectorAll(includeSelector));
|
|
151
153
|
var exclude = node.querySelectorAll(excludeSelector);
|
|
152
154
|
|
|
153
155
|
for (var i = 0; i < exclude.length; i++) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (index >= 0) {
|
|
157
|
-
include.splice(index, 1);
|
|
158
|
-
}
|
|
156
|
+
include["delete"](exclude[i]);
|
|
159
157
|
}
|
|
160
158
|
|
|
161
|
-
return include;
|
|
159
|
+
return Array.from(include);
|
|
162
160
|
};
|
|
163
161
|
/**
|
|
164
162
|
* Determines if `node` is a spotlight container
|
|
@@ -342,8 +340,13 @@ var getContainerNode = function getContainerNode(containerId) {
|
|
|
342
340
|
exports.getContainerNode = getContainerNode;
|
|
343
341
|
|
|
344
342
|
var navigableFilter = function navigableFilter(node, containerId) {
|
|
343
|
+
var nodeStyle = node && (0, _snapshot.isWindowReady)() && window.getComputedStyle(node);
|
|
345
344
|
var config = getContainerConfig(containerId);
|
|
346
345
|
|
|
346
|
+
if (!nodeStyle || nodeStyle.display === 'none' || nodeStyle.visibility === 'hidden') {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
|
|
347
350
|
if (config && typeof config.navigableFilter === 'function') {
|
|
348
351
|
if (config.navigableFilter(node, containerId) === false) {
|
|
349
352
|
return false;
|