When I created my menu structures, I used a double linked list so I could scroll up and down through a dynamically created list. I also had a “in” pointer so I could step down to a sub menu.
Each menu item had a code that identified that it was either a menu item that pointed to a sub menu, or a “bottom” level.
I used hardware buttons to scroll up and down my list and a “click” button to return a value on the bottom level items or step in or out of menu levels. By having each menu item including a pointer to its peers and to any sub menu, moving through the menues was easy and the code did not have to know anything about the structure of the menu in advance.
The menu was dynamically created in setup() and by storing pointers to various parts if the structure that were of particular interest, I could also “right click” to short cut menus.