@enact/spotlight 4.5.0-rc.1 → 4.5.0-rc.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 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-rc.2] - 2022-07-06
6
+
7
+ ### Fixed
8
+
9
+ - `spotlight` to not leave the restrict container after returning from another app
10
+
5
11
  ## [4.5.0-rc.1] - 2022-06-23
6
12
 
7
13
  No significant changes.
@@ -16,8 +16,6 @@ var _useClass = _interopRequireDefault(require("@enact/core/useClass"));
16
16
 
17
17
  var _react = require("react");
18
18
 
19
- var _reactDom = _interopRequireDefault(require("react-dom"));
20
-
21
19
  var _SpottableCore = require("./SpottableCore");
22
20
 
23
21
  var _excluded = ["spotRef", "emulateMouse", "selectionKeys", "spotlightDisabled"];
@@ -115,8 +113,7 @@ var useSpottable = function useSpottable() {
115
113
  spotlightDisabled: spotlightDisabled
116
114
  }, props), context.current);
117
115
  (0, _react.useLayoutEffect)(function () {
118
- // eslint-disable-next-line react/no-find-dom-node
119
- hook.load(_reactDom["default"].findDOMNode(spotRef || null));
116
+ hook.load(spotRef || null);
120
117
  return function () {
121
118
  hook.unload();
122
119
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enact/spotlight",
3
- "version": "4.5.0-rc.1",
3
+ "version": "4.5.0-rc.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-rc.1",
21
+ "@enact/core": "^4.5.0-rc.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
@@ -1063,11 +1063,15 @@ function containsContainer(outerContainerId, innerContainerId) {
1063
1063
 
1064
1064
 
1065
1065
  function mayActivateContainer(containerId) {
1066
- var currentContainerId = getLastContainer(); // If the current container is restricted to 'self-only' and if the next container to be
1067
- // activated is not inside the currently activated container, the next container should not be
1068
- // activated.
1066
+ var currentContainerId = getLastContainer(); // If the current container or its outer containers are restricted to 'self-only' and
1067
+ // if the next container to be activated is not inside the restrict container,
1068
+ // the next container should not be activated.
1069
1069
 
1070
- return !isRestrictedContainer(currentContainerId) || containsContainer(currentContainerId, containerId);
1070
+ var currentContainerNode = getContainerNode(currentContainerId);
1071
+ var restrictContainer = getContainersForNode(currentContainerNode).reduceRight(function (result, outerContainerId) {
1072
+ return result || (isRestrictedContainer(outerContainerId) ? outerContainerId : null);
1073
+ }, null);
1074
+ return !restrictContainer || containsContainer(restrictContainer, containerId);
1071
1075
  }
1072
1076
 
1073
1077
  function getDefaultContainer() {