Skip to content

Commit 97ae2f9

Browse files
Fix Accessibility Bug
1 parent 8fec1f9 commit 97ae2f9

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

AIDevGallery/Controls/ModelPicker/ModelOrApiPicker.xaml.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Microsoft.UI.Xaml;
1111
using Microsoft.UI.Xaml.Controls;
1212
using Microsoft.UI.Xaml.Input;
13+
using System;
1314
using System.Collections.Generic;
1415
using System.Collections.ObjectModel;
1516
using System.Linq;
@@ -24,6 +25,7 @@ internal sealed partial class ModelOrApiPicker : UserControl
2425

2526
public delegate void SelectedModelsChangedEventHandler(object sender, List<ModelDetails?> modelDetails);
2627
public event SelectedModelsChangedEventHandler? SelectedModelsChanged;
28+
public event EventHandler? Closed;
2729

2830
public ModelOrApiPicker()
2931
{
@@ -53,6 +55,12 @@ public void Show(List<ModelDetails?>? selectedModels = null)
5355
public void Hide()
5456
{
5557
this.Visibility = Visibility.Collapsed;
58+
OnClosed();
59+
}
60+
61+
private void OnClosed()
62+
{
63+
Closed?.Invoke(this, EventArgs.Empty);
5664
}
5765

5866
public async Task<List<ModelDetails?>> Load(List<List<ModelType>> modelOrApiTypes, ModelDetails? initialModelToLoad = null)

AIDevGallery/Controls/ModelPicker/ModelPickerViews/OnnxPickerView.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
CornerRadius="{StaticResource ControlCornerRadius}"
105105
GotFocus="ItemContainer_GotFocus"
106106
PointerEntered="ItemContainer_PointerEntered"
107+
AutomationProperties.Name="{x:Bind ModelDetails.Name, Mode=OneWay}"
107108
Tag="{x:Bind}">
108109
<ItemContainer.Resources>
109110
<SolidColorBrush x:Key="ItemContainerPointerOverBackground" Color="Transparent" />

AIDevGallery/Pages/Scenarios/ScenarioPage.xaml.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,14 @@ private void ActionButtonsGrid_SizeChanged(object sender, SizeChangedEventArgs e
415415

416416
private void ModelBtn_Click(object sender, RoutedEventArgs e)
417417
{
418+
var button = sender as Button;
419+
420+
var picker = App.MainWindow.ModelPicker;
421+
picker.Closed += (s, args) =>
422+
{
423+
button?.Focus(FocusState.Programmatic);
424+
};
425+
418426
App.MainWindow.ModelPicker.Show(modelDetails.ToList());
419427
}
420428

0 commit comments

Comments
 (0)