You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using a TextBox as the SettingsExpander's Footer content, spaces cannot be entered into the TextBox. Typing characters works normally, but pressing the spacebar has no effect.
To Reproduce
Steps to reproduce the behavior:
Create a SettingsExpander component.
Set a TextBox as the SettingsExpander.Footer content.
Run the application.
Try to type into the TextBox and attempt to enter spaces.
This appears to be the toggle button that is handling the Space key. For now I've worked around this issue by adding a custom ToggleButton and re-templated the SettingsExpander style to replace the ToggleButton with the custom ToggleButton.
public class SettingsExpanderToggleButton : ToggleButton
{
protected override void OnKeyDown(KeyEventArgs args)
{
if (args.Key == Key.Space)
{
IsChecked = !IsChecked;
}
else
{
base.OnKeyDown(args);
}
}
}
So this is a bug in Avalonia because Button is handling all key down events as part of its core logic. For most cases this is fine (you normally don't put a textbox in a button. But for Expander, the entire header is a button and we hit this problem.
I opened an issue upstream with a solution that WPF uses.
Describe the bug
When using a TextBox as the SettingsExpander's Footer content, spaces cannot be entered into the TextBox. Typing characters works normally, but pressing the spacebar has no effect.
To Reproduce
Steps to reproduce the behavior:
Code Example
Expected behavior
Spaces should be entered into the TextBox when the spacebar is pressed.
Actual behavior
Characters can be entered into the TextBox, but spaces cannot.
Desktop/Platform
OS: Windows 11
FluentAvalonia Version: 2.1.0-preview6
Avalonia Version: 11.1.0-rc1
The text was updated successfully, but these errors were encountered: