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

Port microsoft/microsoft-ui-xaml#4932 #662

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading