Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@enact/spotlight

Package Overview
Dependencies
Maintainers
1
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@enact/spotlight - npm Package Compare versions

Comparing version 3.3.0-alpha.13 to 3.3.0-alpha.14

6

CHANGELOG.md

@@ -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 @@

4

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc