( containerElement: HTMLElement | null, scrollElement: ScrollElement | undefined )
| 16 | } |
| 17 | |
| 18 | export function getScrollTarget( |
| 19 | containerElement: HTMLElement | null, |
| 20 | scrollElement: ScrollElement | undefined |
| 21 | ): ScrollTarget | null { |
| 22 | if (scrollElement === "window") { |
| 23 | // Use the container's own window (e.g. a popup rendered into via a portal) |
| 24 | return containerElement ? getOwnerWindow(containerElement) : null; |
| 25 | } |
| 26 | |
| 27 | return scrollElement ?? null; |
| 28 | } |
| 29 | |
| 30 | export function getScrollPosition( |
| 31 | target: ScrollTarget, |
no test coverage detected