How to stop mouse click on the viewport to stealing focus from focused button?

I have a simple menu, and the only thing focusable are the buttons, but whenever I click anywhere else on the viewport which aren’t buttons, whatever button is currently focused loses keyboard focus and I have to click a button with the mouse to regain focus.

How to prevent this from happening?

set other Ui to not hit testable self so it wont get hit when you click it

yeah for some reason that doesn’t work. I had to make a giant invisible button that covered the entire viewport behind the menu, and set it to focus on whatever was focused before clicking. janky, but works