react-beautiful-dnd-next
Version:
Beautiful and accessible drag and drop for lists with React
22 lines (16 loc) • 368 B
JavaScript
// @flow
const isElementFixed = (el: Element): boolean =>
window.getComputedStyle(el).position === 'fixed';
const find = (el: ?Element): boolean => {
// cannot do anything else!
if (el == null) {
return false;
}
// keep looking
if (!isElementFixed(el)) {
return find(el.parentElement);
}
// success!
return true;
};
export default find;