isFixedPosition

Commons
stable

Walks up the DOM ancestry of an element and returns true if any ancestor (including the element itself) has position: fixed in its computed style. Used by overlay and location strategies to decide whether teleport targets need special handling.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

el
HTMLElement
The element from which to start the ancestor walk. When undefined, the function immediately returns false.

API

Return value

The value returned by this util.

true when el or any of its offsetParent ancestors has position: fixed; false otherwise.

Usage

Examples

Ready-to-paste usage snippets.

Detect fixed-position ancestors

typescript