Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara authored Mar 14, 2024
1 parent 58f337c commit 9eb38ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 19 additions & 3 deletions ModernWpf.Controls/CommandBarFlyout/CommandBarFlyoutToolBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,15 @@ void EnsureAutomationSetCountAndPosition()
{
if (command is UIElement commandAsUIElement)
{
if (commandAsUIElement.Visibility == Visibility.Visible)
// Don't count AppBarSeparator if IsTabStop is false
if (commandAsUIElement is AppBarSeparator separator)
{
if (!separator.IsTabStop)
{
continue;
}
}
else if (commandAsUIElement.Visibility == Visibility.Visible)
{
sizeOfSet++;
}
Expand All @@ -650,7 +658,15 @@ void EnsureAutomationSetCountAndPosition()
{
if (command is UIElement commandAsUIElement)
{
if (commandAsUIElement.Visibility == Visibility.Visible)
// Don't count AppBarSeparator if IsTabStop is false
if (commandAsUIElement is AppBarSeparator separator)
{
if (!separator.IsTabStop)
{
continue;
}
}
else if (commandAsUIElement.Visibility == Visibility.Visible)
{
AutomationProperties.SetSizeOfSet(commandAsUIElement, sizeOfSet);
}
Expand Down Expand Up @@ -868,7 +884,7 @@ bool IsControlFocusable(
return control != null &&
control.Visibility == Visibility.Visible &&
control.IsEnabled &&
(!checkTabStop || control.IsTabStop);
(control.IsTabStop || (!checkTabStop && !(control is AppBarSeparator))); // AppBarSeparator is not focusable if IsTabStop is false
}

Control GetFirstTabStopControl(
Expand Down
2 changes: 2 additions & 0 deletions test/ModernWpfTestApp/CommandBarFlyoutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
Opened="OnFlyoutOpened"
Closed="OnFlyoutClosed">
<ui:AppBarButton x:Name="CutButton1" AutomationProperties.AutomationId="CutButton1" Label="Cut" Icon="Cut" Click="OnElementClicked" />
<AppBarSeparator />
<ui:AppBarButton x:Name="CopyButton1" AutomationProperties.AutomationId="CopyButton1" Label="Copy" Icon="Copy" Click="OnElementClicked" />
<ui:AppBarButton x:Name="PasteButton1" AutomationProperties.AutomationId="PasteButton1" Label="Paste" Icon="Paste" Click="OnElementClicked" />
<ui:AppBarButton x:Name="BoldButton1" AutomationProperties.AutomationId="BoldButton1" Label="Bold" Icon="Bold" Click="OnElementClicked" />
<ui:AppBarButton x:Name="ItalicButton1" AutomationProperties.AutomationId="ItalicButton1" Label="Italic" Icon="Italic" Click="OnElementClicked" />
<ui:AppBarToggleButton x:Name="UnderlineButton1" AutomationProperties.AutomationId="UnderlineButton1" Label="Underline" Icon="Underline" Click="OnElementClicked" />
<muxc:CommandBarFlyout.SecondaryCommands>
<ui:AppBarButton x:Name="UndoButton1" AutomationProperties.AutomationId="UndoButton1" Label="Undo" Icon="Undo" Click="OnElementClicked" />
<AppBarSeparator IsTabStop="False" />
<ui:AppBarButton x:Name="RedoButton1" AutomationProperties.AutomationId="RedoButton1" Label="Redo" Icon="Redo" Click="OnElementClicked" />
<ui:AppBarButton x:Name="SelectAllButton1" AutomationProperties.AutomationId="SelectAllButton1" Label="Select all" Click="OnElementClicked" />
<ui:AppBarToggleButton x:Name="FavoriteToggleButton1" AutomationProperties.AutomationId="FavoriteToggleButton1" Label="Favorite" Icon="Favorite" Checked="OnElementChecked" Unchecked="OnElementUnchecked" />
Expand Down

0 comments on commit 9eb38ca

Please sign in to comment.