Files
url_tracker_tool/node_modules/focus-lock/dist/es2015/focusInside.js
Andrei 58f8093689 Rebrand from 'Redirect Intelligence v2' to 'URL Tracker Tool V2' throughout UI
- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
2025-08-19 19:12:23 +00:00

23 lines
1.1 KiB
JavaScript

import { contains } from './utils/DOMutils';
import { getAllAffectedNodes } from './utils/all-affected';
import { getFirst, toArray } from './utils/array';
import { getActiveElement } from './utils/getActiveElement';
var focusInFrame = function (frame, activeElement) { return frame === activeElement; };
var focusInsideIframe = function (topNode, activeElement) {
return Boolean(toArray(topNode.querySelectorAll('iframe')).some(function (node) { return focusInFrame(node, activeElement); }));
};
/**
* @returns {Boolean} true, if the current focus is inside given node or nodes.
* Supports nodes hidden inside shadowDom
*/
export var focusInside = function (topNode, activeElement) {
// const activeElement = document && getActiveElement();
if (activeElement === void 0) { activeElement = getActiveElement(getFirst(topNode).ownerDocument); }
if (!activeElement || (activeElement.dataset && activeElement.dataset.focusGuard)) {
return false;
}
return getAllAffectedNodes(topNode).some(function (node) {
return contains(node, activeElement) || focusInsideIframe(node, activeElement);
});
};