Open Klemms opened 4 months ago
Hello @Klemms!
This is by design, as anything "focusable" should inherently be focusable.
You could use the focusable
flag to disable this behavior (e.g focusable: false
), if you're able to deduce when there are children (it should be focusable) and when there are not.
It might be a bit misleading to have something be focusable: true
, but then it is not focusable because it has no direct children, so this is why we've left this to the implementer to figure out as part of they own setup.
Is your feature request related to a problem? Please describe. Currently, if you have a component that is a focusable container, but happens to have no children or children that don't implement useFocusable, the focusable container can still get the focus.
Describe the solution you'd like Focusable containers which dont have any focusable children should be skipped when considering the next element to focus in that direction.
Describe alternatives you've considered I have tried different combinations of options on the useFocusable hook but havent been able to find a good solution
Additional context In my case, I am using FocusContext for a very generic component that has to report getting the focus to some manager, however it just accepts any children and has no idea of what is actually getting passed to it. The issue im getting is that in case the child that is passed to it is a rail which has no data inside, then the container will still get focused while scrolling down even though theres nothing to actually focus.