UNPKG

react-beautiful-dnd

Version:

Beautiful, accessible drag and drop for lists with React.js

26 lines (20 loc) 612 B
// @flow const isScrollable = (...values: string[]): boolean => values.some((value: string): boolean => (value === 'auto' || value === 'scroll')); const isElementScrollable = (el: Element) => { const style = window.getComputedStyle(el); return isScrollable(style.overflow, style.overflowY, style.overflowX); }; const getClosestScrollable = (el: ?Element): ?Element => { // cannot do anything else! if (el == null) { return null; } if (!isElementScrollable(el)) { return getClosestScrollable(el.parentElement); } // success! return el; }; export default getClosestScrollable;