Skip to content

Commit

Permalink
Fixing keyboard navigation in backstage
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Dec 14, 2022
1 parent 981f74d commit 3f9477b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Fluent.Ribbon/Controls/Backstage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ static Backstage()
DefaultStyleKeyProperty.OverrideMetadata(typeof(Backstage), new FrameworkPropertyMetadata(typeof(Backstage)));
// Disable QAT for this control
CanAddToQuickAccessToolBarProperty.OverrideMetadata(typeof(Backstage), new FrameworkPropertyMetadata(BooleanBoxes.FalseBox));

KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(Backstage), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle));
}

/// <summary>
Expand Down Expand Up @@ -391,9 +389,6 @@ protected virtual bool Show()
this.CollapseWindowsFormsHosts(this.ownerWindow);
}

var content = this.Content as IInputElement;
content?.Focus();

return true;
}

Expand Down Expand Up @@ -457,6 +452,11 @@ void HandleStoryboardOnCompleted(object? sender, EventArgs args)
{
this.AdornerLayer?.Update();

if (this.Content?.IsVisible == true)
{
this.Content.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
}

storyboard.Completed -= HandleStoryboardOnCompleted;
}
}
Expand Down Expand Up @@ -498,6 +498,8 @@ void HandleStoryboardOnCompleted(object? sender, EventArgs args)
this.RestoreParentProperties();

storyboard.Completed -= HandleStoryboardOnCompleted;

this.Focus();
}
}

Expand Down

0 comments on commit 3f9477b

Please sign in to comment.