Skip to content
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

Disabled controls can be focused with the keyboard #6439

Closed
iminashi opened this issue Aug 18, 2021 · 3 comments · Fixed by #6466
Closed

Disabled controls can be focused with the keyboard #6439

iminashi opened this issue Aug 18, 2021 · 3 comments · Fixed by #6466

Comments

@iminashi
Copy link

Describe the bug

Controls can be focused using the tab key even though their parent is disabled.

To Reproduce

  1. Create a panel that has TextBox child.
  2. Set IsEnabled to false on the panel.
  3. The TextBox can be focused with the tab key and the text can be edited.

If you do this:

<StackPanel IsEnabled="False">
      <TextBox IsEnabled="False" />
      <AutoCompleteBox IsEnabled="False" />
</StackPanel>

Then the TextBox cannot be focused, but the AutoCompleteBox can.

Expected behavior

Child elements of a disabled parent should not be focusable.

Desktop

  • OS: Windows 10
  • Version: 0.10.7

Additional context

This worked correctly in 0.10.6.

@iminashi iminashi added the bug label Aug 18, 2021
@grokys grokys added this to To do in @grokys todos via automation Aug 18, 2021
@grokys
Copy link
Member

grokys commented Aug 18, 2021

Looks like a pretty major regression due to the new tab handling code ported from WPF. Will fix as soon as I'm back from vacation

@danwalmsley
Copy link
Member

Also invisible controls!

@grokys
Copy link
Member

grokys commented Aug 25, 2021

This is because of a difference in how WPF and Avalonia handle IsEnabled. In WPF if reflects both the enabled state of the actual control and the effectively enabled state which comes from ancestor controls. In Avalonia that effectively enabled state is exposed on a different property: IsEffectivelyEnabled.

When I ported the tab navigation code from WPF, I didn't take that into account. Will fix.

@danwalmsley I can't repro this happening with invisible controls, do you have a repro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
@grokys todos
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants