Files
standardnotes-app-web/packages/web/src/javascripts/Components/Popover/Utils/getAbsolutePositionedParent.tsx

20 lines
396 B
TypeScript

export function getAbsolutePositionedParent(element: HTMLElement | null): HTMLElement | null {
if (!element) {
return null
}
const parent = element.parentElement
if (!parent) {
return null
}
const position = window.getComputedStyle(parent).getPropertyValue('position')
if (position === 'absolute') {
return parent
}
return getAbsolutePositionedParent(parent)
}