Socket
Socket
Sign inDemoInstall

@vaadin/vaadin-overlay

Package Overview
Dependencies
Maintainers
14
Versions
268
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/vaadin-overlay - npm Package Compare versions

Comparing version 3.2.3 to 3.2.4

2

package.json

@@ -14,3 +14,3 @@ {

"name": "@vaadin/vaadin-overlay",
"version": "3.2.3",
"version": "3.2.4",
"main": "vaadin-overlay.js",

@@ -17,0 +17,0 @@ "author": "Vaadin Ltd",

@@ -311,2 +311,10 @@ /**

/**
* Set to true to enable restoring of focus when overlay is closed.
*/
restoreFocusOnClose: {
type: Boolean,
value: false,
},
_mouseDownInside: {

@@ -510,2 +518,4 @@ type: Boolean

if (opened) {
// Store focused node.
this.__restoreFocusNode = this._getActiveElement();
this._animatedOpening();

@@ -533,3 +543,4 @@

const name = getComputedStyle(this).getPropertyValue('animation-name');
return name && name != 'none';
const hidden = getComputedStyle(this).getPropertyValue('display') === 'none';
return !hidden && name && name != 'none';
}

@@ -591,2 +602,16 @@

this.removeAttribute('closing');
if (this.restoreFocusOnClose && this.__restoreFocusNode) {
// If the activeElement is `<body>` or inside the overlay,
// we are allowed to restore the focus. In all the other
// cases focus might have been moved elsewhere by another
// component or by the user interaction (e.g. click on a
// button outside the overlay).
const activeElement = this._getActiveElement();
if (activeElement === document.body || this._deepContains(activeElement)) {
this.__restoreFocusNode.focus();
}
this.__restoreFocusNode = null;
}
};

@@ -865,2 +890,31 @@

}
_getActiveElement() {
let active = document._activeElement || document.activeElement;
// document.activeElement can be null
// https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement
// In IE 11, it can also be an object when operating in iframes
// or document.documentElement (when overlay closed on outside click).
// In these cases, default it to document.body.
if (!active || active === document.documentElement || active instanceof Element === false) {
active = document.body;
}
while (active.shadowRoot && active.shadowRoot.activeElement) {
active = active.shadowRoot.activeElement;
}
return active;
}
_deepContains(node) {
if (this.contains(node)) {
return true;
}
let n = node;
const doc = node.ownerDocument;
// walk from node to `this` or `document`
while (n && n !== doc && n !== this) {
n = n.parentNode || n.host;
}
return n === this;
}
}

@@ -867,0 +921,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