Can't properly disable focused controls
See original GitHub issueDescribe the bug
Some key events are still fully functional in disabled+focused controls. Probably related to https://github.com/AvaloniaUI/Avalonia/issues/6957, but the PR does not solves other controls. With Fluent theme, control style don’t get updated. But I can see in the debugger that IsEnabled is already set to false.
To Reproduce
- Make
TextBoxfocus - Disable the
TextBox - Start typing…
Expected behavior Disabled controls should not accept key events.
Screenshots
Desktop (please complete the following information):
- OS: Debian (dwm)
- Version: 0.10.10
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:12 (9 by maintainers)
Top Results From Across the Web
How to remove focus around buttons on click
The .blur() method correctly removes the focus highlighting and doesn't ... in keyboard users being unable to interact with the control.
Read more >How do I disable Focused Inbox?
If you'd like to turn Focused Inbox off, or change whether your notifications are synced to Focused Inbox, tap the overflow icon in...
Read more >Update on Focused Inbox rollout for Outlook 2016 ...
See How modern authentication works for Office 2016 client apps to ensure the Registry key is properly set. Previous use of Clutter. To...
Read more >Is there a way to fully disable touch focus on EOS RP?
You can disable touch control altogether. ... Unfortunately, there is no menu option to JUST disable touch focusing (which is really dumb).
Read more >How to Prevent Programs From Stealing Focus in Windows
Unfortunately, it's not possible for Windows to block all programs from stealing focus and still work properly—it's just not built with the brains...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

In WPF a control is no longer interactive when it is disabled (IsEnabled=false). The focus will be lost. This can also lead to a null value for the current focused element when the current keyboard focus “holder” gets disabled by a binding etc.
I am dealing with a similar issue in Avalonia. I have disabled controls but unfortunately I can still access them via Ctrl+Tab including changing is values via keyboard. In my opinion this is a bug. Why should I disable the control in the first place when interacting with them is still possible?
Avalonia works correct when the “IsEnabled” state is set in the AXAML file directly. Then no interaction is possible. But setting it later (or at container level) will lead to a “half disabled” control. Visually it is but from interaction perspective it is not.
Seems to be a fairly fundamental issue. I’m surprised it has so far gone unnoticed except for the special cases. I see lots of examples:
https://github.com/AvaloniaUI/Avalonia/pull/6632 https://github.com/AvaloniaUI/Avalonia/pull/7206