Skip to content

Commit

Permalink
fix: Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
workgroupengineering committed Aug 12, 2024
1 parent 122b204 commit 348dce1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Avalonia.Controls/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ protected override void OnKeyDown(KeyEventArgs e)
e.Handled = true;
break;
case Key.Space:
// Handle Space only current focus control
if (TopLevel.GetTopLevel(this)?.FocusManager?.GetFocusedElement() == this)
// Avoid handling Space if the button isn't focused: a child TextBox might need it for text input
if (IsFocused)
{
if (ClickMode == ClickMode.Press)
{
Expand All @@ -313,8 +313,8 @@ protected override void OnKeyDown(KeyEventArgs e)
/// <inheritdoc/>
protected override void OnKeyUp(KeyEventArgs e)
{
// Handle Space only current focus control
if (e.Key == Key.Space && TopLevel.GetTopLevel(this)?.FocusManager?.GetFocusedElement() == this)
// Avoid handling Space if the button isn't focused: a child TextBox might need it for text input
if (e.Key == Key.Space && IsFocused)
{
if (ClickMode == ClickMode.Release)
{
Expand Down

0 comments on commit 348dce1

Please sign in to comment.