UNPKG

@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

11 lines 606 B
import { getNearestOverflowAncestor } from './getNearestOverflowAncestor'; import { isOverflowElement } from './is.utils'; export const getOverflowAncestors = (node, list = []) => { const scrollableAncestor = getNearestOverflowAncestor(node); const isBody = scrollableAncestor === node.ownerDocument?.body; if (isBody) { return list.concat(window, window.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []); } return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor)); }; //# sourceMappingURL=getOverflowAncestors.js.map