What's the deal with FocusMode and mouse clicks?

Godot Version



I noticed that some of my Buttons were doing weird things after being clicked for the first time (either displaying an unwanted frame for an indefinite time after being clicked, or losing the ability to display their Hover state after their first click), and it turned out this was because their FocusMode was being set to All, so clicks were focusing the button and changing its visual appearance in a way that persisted until I clicked any other button in the UI. Basically, all buttons in the UI were behaving like a collective radio button set, which was very annoying and distracting.

I changed the setting to None, and everything works as I’d expect for a mouse interface. However, in the future I’d like to support keyboard and controller navigation alongside mouse navigation. Unfortunately there are only three options for FocusMode - All (mouse/keyboard/controller), Click (mouse only), and None. The lack of a keyboard/controller-only option feels like a weird omission.

It’s admittedly not something I’ve thought a ton about, but I feel like most games and software I use don’t visually “focus” GUI buttons when you click on them in the same way they do when you navigate around with a mouse or controller. Obviously things like tabs and text boxes are focused on click, but buttons that perform a function without altering the rest of the GUI aren’t something I’d expect to pick up a persistent change just from being clicked once, unless they are radio buttons or toggles.

I sometimes see hovering trigger a focus state, for example in main menus of console-focused games where there’s some kind of bar or pip that marks the last-hovered item in the menu, but that’s hovering, not clicking. Hover states are common, and much clearer, since they activate and deactivate according to cursor position, and don’t continue to signal activation after the cursor (and presumably the user’s attention) has moved on.

I see there was a bit of discussion about a fourth mode, but it seems it was ultimately discarded as not planned.

So working with the tools we’re given, what’s the best way within Godot to support focus for keyboards and controllers without simultaneously producing distracting or confusing “focus” visual effects upon mouse clicks? Or is there some other angle to this I’m not thinking of, like is there somewhere in Godot that manages which inputs trigger focus, and I could just disable the mouse there, rather than controlling how Controls receive focus?

I’ve been struggling with this thing all day, buttons ain’t enabling without clicking twice also hover state not working. Still trying to figure it out how and why it’s happening.