isPotentiallyScrollable
Commons
stable
Returns true when an element has overflow-y set to "scroll" or "auto" via computed styles, meaning it is a potential scroll container. Used by scroll strategy utilities to locate the relevant ancestor.
API
Signature
Signature TypeScript complète, extraite du fichier util.
This function accesses window.getComputedStyle and only works in a browser context. It always returns false during SSR.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- elElement | null
- The DOM element to inspect. Returns false immediately for null, undefined, or non-element nodes (nodeType !== ELEMENT_NODE).
API
Valeur de retour
La valeur retournée par cet util.
- true when the element has overflow-y: scroll or overflow-y: auto in its computed style; false for all other cases including missing or null elements.
Usage
Exemples
Extraits de code prêts à coller.
Detecting a scrollable container