-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Different style for disabled focused button #7320
Comments
The behavior in web browsers is to not allow focusing disabled items. I think we should align on this, but it's a compatibility-breaking change so it needs to be opt-in with a project setting. To test browser behavior, try entering the following in https://jsbin.com, click on the first item in the preview on the right then use Tab: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Focus disabled</title>
</head>
<body>
<input type="text" value="Input text"><br>
<input type="text" value="Input text disabled" disabled><br>
<button>Button</button><br>
<button disabled>Button disabled</button>
</body>
</html> |
I consider native GUI toolkits as references for UI quality, such as Qt, Android, Windows Forms and similar, rather than the web browser. The latter was engineered to display documents then tweaked to make application UIs. But it is up to a different debate. The behavior should be configurable IMHO if we add support for tab focus on disabled items. While most desktop applications also skip the focus on disabled items, there can be cases where it is not desirable to have sudden jumps while browsing through the UI using the keyboard. I am thinking about long lists, for instance, that may be inside a scrolling container. |
Related: godotengine/godot#68067. |
Describe the project you are working on
A mobile app.
Describe the problem or limitation you are having in your project
When I disable a button and the user press it, it became focused, and therefore its style changes to the focus one.
I don't want to set
focus_mode
to none because I still want to allow focusing on it*. Moreover, I would have to add some code to changefocus_mode
whendisabled
changes.*I will try to make a multi-platform app, so with the keyboard you would be able to change focus around buttons.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add another style for when the button is disabled and focused.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add another
StyleBox
in the theme editor for that case.If this enhancement will not be used often, can it be worked around with a few lines of script?
I assume it could be done.
Is there a reason why this should be core and not an add-on in the asset library?
It is important to distinguish when a button is enabled or not, no matter if it is focused.
The text was updated successfully, but these errors were encountered: