Open/Close UI menu with key press?

Check my post here:

Start from the bit that goes:

Not stupid at all, actually. It’s just an input processing thing.