How to share focus between game and UI?

i usually spawn all widgets from the HUD and keep track of their state in the HUD, and so far it hasn’t made much of a mess, but i don’t have a ton of menus. but even if you have alot of menus, you could let them share a similar interface, where the HUD just calls functions that correspond to each button.

if a menu has more than 3 degrees of freedom, it should probably be redesigned for usability, especially if its a console game or designed for a gamepad. with a PC and mouse, you have more room to make complicated interfaces with many different menus open at the same time, but i always try to keep UI simple, with only 1 menu active, because its less confusing for new players and easier to port to consoles.