@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
15 lines • 828 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOverflowAncestors = void 0;
const getNearestOverflowAncestor_1 = require("./getNearestOverflowAncestor");
const is_utils_1 = require("./is.utils");
const getOverflowAncestors = (node, list = []) => {
const scrollableAncestor = (0, getNearestOverflowAncestor_1.getNearestOverflowAncestor)(node);
const isBody = scrollableAncestor === node.ownerDocument?.body;
if (isBody) {
return list.concat(window, window.visualViewport || [], (0, is_utils_1.isOverflowElement)(scrollableAncestor) ? scrollableAncestor : []);
}
return list.concat(scrollableAncestor, (0, exports.getOverflowAncestors)(scrollableAncestor));
};
exports.getOverflowAncestors = getOverflowAncestors;
//# sourceMappingURL=getOverflowAncestors.js.map