(element: Element | null)
| 3 | * is not contained in a scrollable element. |
| 4 | */ |
| 5 | export function getScrollContainer(element: Element | null): Element | null { |
| 6 | if (!element || element === document.body) { |
| 7 | return null |
| 8 | } |
| 9 | |
| 10 | return isScrollable(element) ? element : getScrollContainer(element.parentElement) |
| 11 | } |
| 12 | |
| 13 | /** Returns `true` if the element is scrollable */ |
| 14 | function isScrollable(element: Element) { |
no test coverage detected