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
Full TypeScript signature sourced from the util file.
This function accesses window.getComputedStyle and only works in a browser context. It always returns false during SSR.
API
Parameters
Input parameters accepted by this util.
- elElement | null
- The DOM element to inspect. Returns false immediately for null, undefined, or non-element nodes (nodeType !== ELEMENT_NODE).
API
Return value
The value returned by this 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
Examples
Ready-to-paste usage snippets.
Detecting a scrollable container