-
-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Hide Control
focus when given via mouse input
#110250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
11b72df
to
8a0123c
Compare
8a0123c
to
4bdb7aa
Compare
4bdb7aa
to
0b89ee1
Compare
You need to add the entries to the expected file, see here |
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 |
bff7bc5
to
019d97b
Compare
Closes godotengine/godot-proposals#6577 (by covering godotengine/godot-proposals#2011).
This PR makes so that
Control
s 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:
Control
with the mouse, giving it focus.Control
.Control
with visible focus.Control
(deviates from how it works in browsers, feedback welcome).Control.grab_focus(true)
.