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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

el
Element | null
The starting element. Returns an empty array when null or undefined.
stopAt
Element | 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

Valeur de retour

La valeur retournée par cet util.

An ordered array of scrollable ancestors, from closest to furthest.

Usage

Exemples

Extraits de code prêts à coller.

Block all scroll containers when a dialog opens

typescript