FocusableCollector

Primitive #7

🔍 Problem it solves

To trap focus or navigate with arrow keys, you need to know which elements inside a container can actually receive focus – including buttons, inputs, links, and elements with tabindex. You must filter out disabled or hidden elements.

✅ Solution

Finds all focusable elements within a given container, respecting tabindex values, disabled states, and visibility. Returns an array of eligible elements.

🧩 Used by components

FocusTrap, RovingTabIndex, AutoFocus, TabTrap, ArrowNavigation, FocusScope

🎮 Interactive demo