@glomex/glomex-dialog
Advanced tools
Comparing version 1.12.3 to 1.12.4
@@ -172,2 +172,29 @@ const NON_VISIBLE_WIDTH = window.innerWidth < 720 ? 320 : 640; | ||
function getActiveElement(root) { | ||
const activeEl = root.activeElement; | ||
if (!activeEl) { | ||
return null; | ||
} | ||
if (activeEl.shadowRoot) { | ||
return getActiveElement(activeEl.shadowRoot); | ||
} | ||
return activeEl; | ||
} | ||
function isInDocument(element, document) { | ||
let currentElement = element; | ||
while (currentElement && currentElement.parentNode) { | ||
if (currentElement.parentNode === document) { | ||
return true; | ||
} if (currentElement.parentNode instanceof window.DocumentFragment) { | ||
currentElement = currentElement.parentNode.host; | ||
} else { | ||
currentElement = currentElement.parentNode; | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
@@ -454,4 +481,4 @@ * A dialog web component that allows docking a video player or | ||
if (event.key === 'Tab') { | ||
const { activeElement } = window.document; | ||
if (activeElement !== this && !this.contains(activeElement)) { | ||
const activeElement = getActiveElement(window.document); | ||
if (activeElement !== this && !isInDocument(activeElement, this)) { | ||
const dialogContent = this.shadowRoot.querySelector('.dialog-content'); | ||
@@ -458,0 +485,0 @@ dialogContent.focus(); |
{ | ||
"name": "@glomex/glomex-dialog", | ||
"version": "1.12.3", | ||
"version": "1.12.4", | ||
"description": "A dialog web component that allows docking a video player or putting it in a lightbox", | ||
@@ -5,0 +5,0 @@ "type": "module", |
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
104918
916