question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't properly disable focused controls

See original GitHub issue

Describe 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

  1. Make TextBox focus
  2. Disable the TextBox
  3. Start typing…

FocusedControlsIssue.zip

Expected behavior Disabled controls should not accept key events.

Screenshots

https://user-images.githubusercontent.com/57059775/147838556-cb1a0b3b-227a-4784-ae87-041aa0ad19d0.mp4

Desktop (please complete the following information):

  • OS: Debian (dwm)
  • Version: 0.10.10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
chkr1011commented, Feb 28, 2022

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.

1reaction
robloocommented, Jan 2, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found