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

@springernature/global-expander

Package Overview
Dependencies
Maintainers
12
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@springernature/global-expander - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

4

HISTORY.md
# History
## 2.0.1 (2020-07-20)
* Replace switch with if/else if when detecting AUTOFOCUS option
* Move AUTOFOCUS into private helper class
## 2.0.0 (2020-07-15)

@@ -4,0 +8,0 @@ * Refactor AUTOFOCUS from boolean to string to set options

41

js/expander.js

@@ -19,2 +19,3 @@ import {makeArray, createEvent} from '@springernature/global-javascript/src/helpers';

this._options = Object.assign({}, defaultOptions, options);
this._autoFocusElement = trigger;
this._triggerEl = trigger;

@@ -26,3 +27,2 @@ this._targetEl = target;

));
this._isOpen = false;

@@ -129,2 +129,20 @@

/**
* AutoFocus
*/
_handleAutoFocus() {
if (this._options.AUTOFOCUS === 'target') {
this._autoFocusElement = this._targetEl;
this._targetEl.setAttribute('tabindex', '-1');
}
if (this._options.AUTOFOCUS === 'firstTabbable') {
this._autoFocusElement = this._targetTabbableItems.length > 0 && this._targetTabbableItems[0];
if (this._autoFocusElement.setSelectionRange) {
this._autoFocusElement.setSelectionRange(0, this._autoFocusElement.value.length);
}
}
this._autoFocusElement.focus();
}
/**
* @public

@@ -157,24 +175,5 @@ */

}
switch (this._options.AUTOFOCUS) {
case 'firstTabbable':
if (this._targetTabbableItems.length > 0) {
const firstTabbableItem = this._targetTabbableItems[0];
firstTabbableItem.focus();
if (firstTabbableItem.setSelectionRange) {
firstTabbableItem.setSelectionRange(0, firstTabbableItem.value.length);
}
}
break;
case 'target':
this._targetEl.setAttribute('tabindex', '-1');
this._targetEl.focus();
break;
default:
break;
}
this._updateAriaAttributes();
this._setupTemporaryEventListeners();
this._handleAutoFocus();
}

@@ -181,0 +180,0 @@

{
"name": "@springernature/global-expander",
"version": "2.0.0",
"version": "2.0.1",
"description": "Frontend package for expanding a target when clicking a toggle",

@@ -5,0 +5,0 @@ "license": "MIT",

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