From 5c5a70ad7392430c6704e143ebda0fa2455d659d Mon Sep 17 00:00:00 2001 From: Jonas Sourlier Date: Mon, 13 Feb 2023 18:11:05 +0100 Subject: [PATCH] fix WLAN menu keyboard accessibility --- .../Controls/ActionCenter/NetworkButton.xaml.cs | 5 +++++ .../Controls/ActionCenter/NetworkControl.xaml.cs | 13 ++++++++++++- .../Controls/Taskbar/NetworkButton.xaml.cs | 5 +++++ .../Controls/Taskbar/NetworkControl.xaml.cs | 8 ++++++++ .../Controls/ActionCenter/NetworkButton.xaml.cs | 5 +++++ .../Controls/ActionCenter/NetworkControl.xaml.cs | 13 ++++++++++++- .../Controls/Taskbar/NetworkButton.xaml.cs | 5 +++++ .../Controls/Taskbar/NetworkControl.xaml.cs | 8 ++++++++ 8 files changed, 60 insertions(+), 2 deletions(-) diff --git a/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkButton.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkButton.xaml.cs index 8e940f07..ac1dc27a 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkButton.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkButton.xaml.cs @@ -34,5 +34,10 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter NetworkNameTextBlock.Text = network.Name; SignalStrengthTextBlock.Text = $"{network.SignalStrength}%"; } + + public void SetFocus() + { + Button.Focus(); + } } } diff --git a/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkControl.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkControl.xaml.cs index d50efecd..47edeb73 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkControl.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkControl.xaml.cs @@ -62,7 +62,18 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter Popup.IsOpen = Popup.IsMouseOver; })); Popup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = IsMouseOver)); - Popup.Opened += (o, args) => Grid.Background = Brushes.Gray; + Popup.Opened += (o, args) => + { + Grid.Background = Brushes.Gray; + Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() => + { + var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; + if (btn != null) + { + btn.SetFocus(); + } + })); + }; Popup.Closed += (o, args) => Grid.Background = originalBrush; WirelessIcon.Child = GetWirelessIcon(0); diff --git a/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkButton.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkButton.xaml.cs index cc3ec142..bc1d7025 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkButton.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkButton.xaml.cs @@ -34,5 +34,10 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar NetworkNameTextBlock.Text = network.Name; SignalStrengthTextBlock.Text = $"{network.SignalStrength}%"; } + + public void SetFocus() + { + Button.Focus(); + } } } diff --git a/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkControl.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkControl.xaml.cs index 0cbbce48..b5f20e52 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkControl.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkControl.xaml.cs @@ -70,6 +70,14 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar { Background = Brushes.LightGray; Button.Background = Brushes.LightGray; + Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() => + { + var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; + if (btn != null) + { + btn.SetFocus(); + } + })); }; Popup.Closed += (o, args) => diff --git a/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkButton.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkButton.xaml.cs index f464dccf..f8456e50 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkButton.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkButton.xaml.cs @@ -34,5 +34,10 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter NetworkNameTextBlock.Text = network.Name; SignalStrengthTextBlock.Text = $"{network.SignalStrength}%"; } + + public void SetFocus() + { + Button.Focus(); + } } } diff --git a/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkControl.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkControl.xaml.cs index 5d1881fd..85da000e 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkControl.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkControl.xaml.cs @@ -62,7 +62,18 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter Popup.IsOpen = Popup.IsMouseOver; })); Popup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = IsMouseOver)); - Popup.Opened += (o, args) => Grid.Background = Brushes.Gray; + Popup.Opened += (o, args) => + { + Grid.Background = Brushes.Gray; + Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() => + { + var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; + if (btn != null) + { + btn.SetFocus(); + } + })); + }; Popup.Closed += (o, args) => Grid.Background = originalBrush; WirelessIcon.Child = GetWirelessIcon(0); diff --git a/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkButton.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkButton.xaml.cs index 76328c51..39f456e6 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkButton.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkButton.xaml.cs @@ -34,5 +34,10 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar NetworkNameTextBlock.Text = network.Name; SignalStrengthTextBlock.Text = $"{network.SignalStrength}%"; } + + public void SetFocus() + { + Button.Focus(); + } } } diff --git a/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkControl.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkControl.xaml.cs index cdb47c27..284b67db 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkControl.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkControl.xaml.cs @@ -70,6 +70,14 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar { Background = Brushes.LightGray; Button.Background = Brushes.LightGray; + Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() => + { + var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; + if (btn != null) + { + btn.SetFocus(); + } + })); }; Popup.Closed += (o, args) =>