How to obtain focus in a button added dynamically in a menu with keyboard/gamepad?

Hello,
I’m trying to do a menu with buttons added dynamically and I need to make it navigable with keyboard/gamepad. No matter what I do, the focus isn’t on the first button added neither on anyone of them. Also, pressing the up/down arrows doesn’t do anything.

This is how I have it now, any ideas on how to make it work?

Thanks in advance