Files
starface-outlook-sync-addin/node_modules/@fluentui/utilities/lib-commonjs/dom/getFirstVisibleElementFromSelector.js
T
Stefan Hacker 37ad745546 first commit
2026-04-03 09:38:48 +02:00

19 lines
1010 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFirstVisibleElementFromSelector = getFirstVisibleElementFromSelector;
var focus_1 = require("../focus");
var getDocument_1 = require("./getDocument");
/**
* Gets the first visible element that matches the given selector
* @param selector - The selector to use to find potential visible elements
* @returns The first visible element that matches the selector, otherwise undefined
*
* @public
*/
function getFirstVisibleElementFromSelector(selector) {
var doc = (0, getDocument_1.getDocument)();
var elements = doc.querySelectorAll(selector);
// Iterate across the elements that match the selector and return the first visible/non-hidden element
return Array.from(elements).find(function (element) { var _a; return (0, focus_1.isElementVisibleAndNotHidden)(element, (_a = doc.defaultView) !== null && _a !== void 0 ? _a : undefined); });
}
//# sourceMappingURL=getFirstVisibleElementFromSelector.js.map