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

16 lines
848 B
JavaScript

import { isElementVisibleAndNotHidden } from '../focus';
import { getDocument } from './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
*/
export function getFirstVisibleElementFromSelector(selector) {
var doc = 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 isElementVisibleAndNotHidden(element, (_a = doc.defaultView) !== null && _a !== void 0 ? _a : undefined); });
}
//# sourceMappingURL=getFirstVisibleElementFromSelector.js.map