@enact/spotlight
Advanced tools
Comparing version 3.3.0-alpha.13 to 3.3.0-alpha.14
@@ -5,2 +5,8 @@ # Change Log | ||
## [3.3.0-alpha.14] - 2020-06-29 | ||
### Added | ||
- `spotlight` container config prop `straightOnlyLeave` to prevent navigation to oblique containers when leaving the current container | ||
## [3.3.0-alpha.13] - 2020-06-22 | ||
@@ -7,0 +13,0 @@ |
{ | ||
"name": "@enact/spotlight", | ||
"version": "3.3.0-alpha.13", | ||
"version": "3.3.0-alpha.14", | ||
"description": "A focus management library", | ||
@@ -24,3 +24,3 @@ "main": "src/spotlight.js", | ||
"dependencies": { | ||
"@enact/core": "^3.3.0-alpha.13", | ||
"@enact/core": "^3.3.0-alpha.14", | ||
"prop-types": "^15.7.2", | ||
@@ -27,0 +27,0 @@ "ramda": "^0.24.1", |
@@ -129,2 +129,4 @@ "use strict"; | ||
straightOnly: false, | ||
straightOnlyLeave: false, | ||
// prevents navigation to oblique containers when leaving the current container | ||
straightOverlapThreshold: 0.5, | ||
@@ -131,0 +133,0 @@ tabIndexIgnoreList: 'a, input, select, textarea, button, iframe, [contentEditable=true]' |
@@ -288,7 +288,19 @@ "use strict"; | ||
var currentContainerId = (0, _last["default"])(currentContainerIds); | ||
var nextContainerIds = (0, _container.getContainersForNode)(next); // prevent focus if 5-way is being held and the next element isn't wrapped by | ||
// the current element's immediate container | ||
var nextContainerIds = (0, _container.getContainersForNode)(next); | ||
if (_5WayKeyHold && nextContainerIds.indexOf(currentContainerId) < 0 && !(0, _container.isContainer5WayHoldable)(currentContainerId)) { | ||
return false; | ||
if (nextContainerIds.indexOf(currentContainerId) < 0) { | ||
// prevent focus if 5-way is being held and the next element isn't wrapped by | ||
// the current element's immediate container | ||
if (_5WayKeyHold && !(0, _container.isContainer5WayHoldable)(currentContainerId)) { | ||
return false; | ||
} | ||
if ((0, _container.getContainerConfig)(currentContainerId).straightOnlyLeave) { | ||
var currentContainerRect = (0, _utils.getContainerRect)(currentContainerId); | ||
var nextContainerRect = (0, _utils.getContainerRect)((0, _last["default"])(nextContainerIds)); // prevent focus for obliquely leaving straightOnlyLeave containers | ||
if ((direction === 'left' || direction === 'right') && (nextContainerRect.bottom < currentContainerRect.top || nextContainerRect.top > currentContainerRect.bottom) || (direction === 'up' || direction === 'down') && (nextContainerRect.right < currentContainerRect.left || nextContainerRect.left > currentContainerRect.right)) { | ||
return false; | ||
} | ||
} | ||
} | ||
@@ -295,0 +307,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
300508
6176
Updated@enact/core@^3.3.0-alpha.14