BoundaryDetector

Primitive #34

🔍 Problem it solves

Overlays inside scrollable containers (e.g., a dropdown inside a modal with overflow: auto) need to know container boundaries, not just viewport boundaries. Otherwise, they may be cut off or positioned incorrectly.

✅ Solution

BoundaryDetector provides getScrollParents(element) to find all ancestors with overflow, getContainingBlock(element) to find the nearest containing block, and isInsideScrollable(element) to check if the element is within a scrollable container. Use these to adjust overlay positioning.

🧩 Used by components

DropdownInModal, TooltipInScrollable, PopoverInSidebar

🎮 Interactive demo