Hide Control focus when given via mouse input#110250
Hide Control focus when given via mouse input#110250Repiteo merged 1 commit intogodotengine:masterfrom
Control focus when given via mouse input#110250Conversation
11b72df to
8a0123c
Compare
8a0123c to
4bdb7aa
Compare
4bdb7aa to
0b89ee1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
0b89ee1 to
2b9caf2
Compare
2b9caf2 to
be1b57a
Compare
be1b57a to
835f087
Compare
|
I was working on a similar thing. This would not make it possible to show the focus stylebox on grab focus with mouse anymore? W3 has this note:
And I did see a couple of comments when looking into this that says that don't think that a users that need a focus indicator only use keyboard all the time, they might use a mouse in some cases and still need the help of a focus indicator. Say you want an accessibility setting in your game that always draw focus, would this be possible with this PR? And how does this handle cases like LineEdit focus? In a browser they get a focus ring even if clicked with a mouse. Does this also include touch input as "mouse"? |
No
Yes. |
835f087 to
bff7bc5
Compare
|
I've added |
|
Did a quick test, mostly works as expected Here are some things that still draw focus on mouse input:
There are some things that will need to be decided case-by-case, for example popup windows drawing focus after being called is generally good, especially when you're expected to type some text in, or to press a button in a simple yes/no confirmation popup. But some popups however draw focus around the main big area (i.e file selection popup) which most apps don't do because it'd be too visually intrusive. Blender is one example of that, it highlights the buttons in yes/no popups but doesn't highlight the main area of the file selection window even though that's what reacts to keyboard shortcuts
It currently also affects the editor and not just the game, which will be undesirable if more than one person is working on the project with different preferences on that |
3830b41 to
58b23fd
Compare
58b23fd to
aeb3a45
Compare
|
Thanks! |
|
There appears to be a special case where, when the 2025-10-01.18-44-46.mp4 |
|
is there anyway to get the old way back, this pr is causing a lot of issues with highlighting. highlighting goes away when clicking on empty space or whilst holding the mouse button down on a button and moving off it. Not good for interfaces that support multiple inputs as you cant tell what had focus last. seems inconsistent between different ui elements as well edit: fix to go back to normal is Project Settings > GUI > Common > Show Focus State on Pointer Event |
|
@automatika-mega Project Settings > GUI > Common > Show Focus State on Pointer Event |
Thank you. Back to working normally! |
Closes godotengine/godot-proposals#6577 (by covering godotengine/godot-proposals#2011).
This PR makes so that
Controls will not show their focus state when activated via a mouse click. It also modifies two functions in order to make this work:Control.grab_focus()has the new optional argumenthide_focus.Control.has_focus()has the new optional argumentignored_hidden_focus.Here's the full ruleset for when focus is shown or not:
Controlwith the mouse, giving it focus.Control.Controlwith visible focus.Control(deviates from how it works in browsers, feedback welcome).Control.grab_focus(true).