getScrollParents
Commons
stable
Collects all scrollable ancestor elements of a given element up to an optional boundary, returning them as an array. Used by overlay scroll strategies to block or track all scroll containers at once.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- elElement | null
- The starting element. Returns an empty array when null or undefined.
- stopAtElement | null
- An optional boundary element. The walk stops when this element is reached (inclusive). When stopAt does not contain el, an empty array is returned immediately.
API
Return value
The value returned by this util.
- An ordered array of scrollable ancestors, from closest to furthest.
Usage
Examples
Ready-to-paste usage snippets.
Block all scroll containers when a dialog opens