possible accessibility bugfix to make JAWS read the help texts

This commit is contained in:
Jonas Sourlier 2022-10-07 14:38:31 +02:00
parent 20a2c11927
commit 900115d66c
18 changed files with 32 additions and 31 deletions

View file

@ -97,7 +97,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
Text.Text = layout.CultureName; Text.Text = layout.CultureName;
Button.ToolTip = tooltip; Button.ToolTip = tooltip;
AutomationProperties.SetHelpText(Button, tooltip); AutomationProperties.SetName(Button, tooltip);
} }
private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)

View file

@ -121,7 +121,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
{ {
Button.ToolTip = text; Button.ToolTip = text;
Text.Text = text; Text.Text = text;
Button.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text); Button.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text);
} }
private UIElement GetWirelessIcon(int signalStrength) private UIElement GetWirelessIcon(int signalStrength)

View file

@ -87,7 +87,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed; PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed;
Text.Text = tooltip; Text.Text = tooltip;
Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed; Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed;
this.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, tooltip); this.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, tooltip);
} }
private void RenderCharge(double charge, BatteryChargeStatus status) private void RenderCharge(double charge, BatteryChargeStatus status)

View file

@ -11,7 +11,7 @@
<RowDefinition Height="1*" /> <RowDefinition Height="1*" />
<RowDefinition Height="1*" /> <RowDefinition Height="1*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock x:Name="TimeTextBlock" Grid.Row="0" Text="{Binding Path=Time}" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Bottom" Focusable="True" AutomationProperties.HelpText="{Binding Path=Time}" /> <TextBlock x:Name="TimeTextBlock" Grid.Row="0" Text="{Binding Path=Time}" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Bottom" Focusable="True" AutomationProperties.Name="{Binding Path=Time}" />
<TextBlock x:Name="DateTextBlock" Grid.Row="1" Text="{Binding Path=Date}" HorizontalAlignment="Center" VerticalAlignment="Top" Focusable="True" AutomationProperties.HelpText="{Binding Path=Date}" /> <TextBlock x:Name="DateTextBlock" Grid.Row="1" Text="{Binding Path=Date}" HorizontalAlignment="Center" VerticalAlignment="Top" Focusable="True" AutomationProperties.Name="{Binding Path=Date}" />
</Grid> </Grid>
</UserControl> </UserControl>

View file

@ -43,7 +43,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
CultureCodeTextBlock.Text = layout.CultureCode; CultureCodeTextBlock.Text = layout.CultureCode;
CultureNameTextBlock.Text = layout.CultureName; CultureNameTextBlock.Text = layout.CultureName;
LayoutNameTextBlock.Text = layout.LayoutName; LayoutNameTextBlock.Text = layout.LayoutName;
System.Windows.Automation.AutomationProperties.SetHelpText(Button, layout.LayoutName); System.Windows.Automation.AutomationProperties.SetName(Button, layout.LayoutName);
} }
} }
} }

View file

@ -121,7 +121,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
LayoutCultureCode.Text = layout.CultureCode; LayoutCultureCode.Text = layout.CultureCode;
Button.ToolTip = tooltip; Button.ToolTip = tooltip;
AutomationProperties.SetHelpText(Button, tooltip); AutomationProperties.SetName(Button, tooltip);
} }
private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)

View file

@ -88,7 +88,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
{ {
WirelessIcon.Child = GetWirelessIcon(network.SignalStrength); WirelessIcon.Child = GetWirelessIcon(network.SignalStrength);
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWirelessConnected).Replace("%%NAME%%", network.Name); Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWirelessConnected).Replace("%%NAME%%", network.Name);
Button.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, Button.ToolTip as string); Button.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, Button.ToolTip as string);
} }
WirelessNetworksStackPanel.Children.Add(button); WirelessNetworksStackPanel.Children.Add(button);

View file

@ -101,7 +101,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
Button.ToolTip = tooltip; Button.ToolTip = tooltip;
PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed; PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed;
Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed; Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed;
this.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, tooltip); this.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, tooltip);
} }
private void RenderCharge(double charge, BatteryChargeStatus status) private void RenderCharge(double charge, BatteryChargeStatus status)

View file

@ -244,8 +244,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
ZoomLevel.Text = $"{value}%"; ZoomLevel.Text = $"{value}%";
var zoomButtonHelpText = text.Get(TextKey.BrowserWindow_ZoomLevelReset).Replace("%%ZOOM%%", value.ToString("0")); var zoomButtonName = text.Get(TextKey.BrowserWindow_ZoomLevelReset).Replace("%%ZOOM%%", value.ToString("0"));
ZoomResetButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, zoomButtonHelpText); ZoomResetButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, zoomButtonName);
}); });
} }
@ -511,7 +511,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
var javascript = @" var javascript = @"
if (typeof __SEB_focusElement === 'undefined') { if (typeof __SEB_focusElement === 'undefined') {
__SEB_focusElement = function (forward) { __SEB_focusElement = function (forward) {
if (!document.body) { return; } if (!document.body)
return;
var items = [].map var items = [].map
.call(document.body.querySelectorAll(['input', 'select', 'a[href]', 'textarea', 'button', '[tabindex]']), function(el, i) { return { el, i } }) .call(document.body.querySelectorAll(['input', 'select', 'a[href]', 'textarea', 'button', '[tabindex]']), function(el, i) { return { el, i } })
.filter(function(e) { return e.el.tabIndex >= 0 && !e.el.disabled && e.el.offsetParent; }) .filter(function(e) { return e.el.tabIndex >= 0 && !e.el.disabled && e.el.offsetParent; })
@ -639,13 +640,13 @@ if (typeof __SEB_focusElement === 'undefined') {
private void LoadText() private void LoadText()
{ {
DeveloperConsoleText.Text = text.Get(TextKey.BrowserWindow_DeveloperConsoleMenuItem); DeveloperConsoleText.Text = text.Get(TextKey.BrowserWindow_DeveloperConsoleMenuItem);
DeveloperConsoleButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text.Get(TextKey.BrowserWindow_DeveloperConsoleMenuItem)); DeveloperConsoleButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_DeveloperConsoleMenuItem));
FindCaseSensitiveCheckBox.Content = text.Get(TextKey.BrowserWindow_FindCaseSensitive); FindCaseSensitiveCheckBox.Content = text.Get(TextKey.BrowserWindow_FindCaseSensitive);
FindMenuText.Text = text.Get(TextKey.BrowserWindow_FindMenuItem); FindMenuText.Text = text.Get(TextKey.BrowserWindow_FindMenuItem);
FindMenuButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text.Get(TextKey.BrowserWindow_FindMenuItem)); FindMenuButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_FindMenuItem));
ZoomText.Text = text.Get(TextKey.BrowserWindow_ZoomMenuItem); ZoomText.Text = text.Get(TextKey.BrowserWindow_ZoomMenuItem);
ZoomInButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text.Get(TextKey.BrowserWindow_ZoomMenuPlus)); ZoomInButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ZoomMenuPlus));
ZoomOutButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text.Get(TextKey.BrowserWindow_ZoomMenuMinus)); ZoomOutButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ZoomMenuMinus));
ReloadButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ReloadButton)); ReloadButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ReloadButton));
BackwardButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_BackwardButton)); BackwardButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_BackwardButton));
ForwardButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ForwardButton)); ForwardButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ForwardButton));

View file

@ -97,7 +97,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
Text.Text = layout.CultureName; Text.Text = layout.CultureName;
Button.ToolTip = tooltip; Button.ToolTip = tooltip;
AutomationProperties.SetHelpText(Button, tooltip); AutomationProperties.SetName(Button, tooltip);
} }
private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)

View file

@ -121,7 +121,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
{ {
Button.ToolTip = text; Button.ToolTip = text;
Text.Text = text; Text.Text = text;
Button.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text); Button.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text);
} }
private UIElement GetWirelessIcon(int signalStrength) private UIElement GetWirelessIcon(int signalStrength)

View file

@ -87,7 +87,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed; PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed;
Text.Text = tooltip; Text.Text = tooltip;
Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed; Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed;
this.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, tooltip); this.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, tooltip);
} }
private void RenderCharge(double charge, BatteryChargeStatus status) private void RenderCharge(double charge, BatteryChargeStatus status)

View file

@ -11,7 +11,7 @@
<RowDefinition Height="1*" /> <RowDefinition Height="1*" />
<RowDefinition Height="1*" /> <RowDefinition Height="1*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock x:Name="TimeTextBlock" Grid.Row="0" Text="{Binding Path=Time}" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Bottom" Focusable="True" AutomationProperties.HelpText="{Binding Path=Time}" /> <TextBlock x:Name="TimeTextBlock" Grid.Row="0" Text="{Binding Path=Time}" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Bottom" Focusable="True" AutomationProperties.Name="{Binding Path=Time}" />
<TextBlock x:Name="DateTextBlock" Grid.Row="1" Text="{Binding Path=Date}" HorizontalAlignment="Center" VerticalAlignment="Top" Focusable="True" AutomationProperties.HelpText="{Binding Path=Date}" /> <TextBlock x:Name="DateTextBlock" Grid.Row="1" Text="{Binding Path=Date}" HorizontalAlignment="Center" VerticalAlignment="Top" Focusable="True" AutomationProperties.Name="{Binding Path=Date}" />
</Grid> </Grid>
</UserControl> </UserControl>

View file

@ -43,7 +43,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
CultureCodeTextBlock.Text = layout.CultureCode; CultureCodeTextBlock.Text = layout.CultureCode;
CultureNameTextBlock.Text = layout.CultureName; CultureNameTextBlock.Text = layout.CultureName;
LayoutNameTextBlock.Text = layout.LayoutName; LayoutNameTextBlock.Text = layout.LayoutName;
System.Windows.Automation.AutomationProperties.SetHelpText(Button, layout.LayoutName); System.Windows.Automation.AutomationProperties.SetName(Button, layout.LayoutName);
} }
} }
} }

View file

@ -121,7 +121,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
LayoutCultureCode.Text = layout.CultureCode; LayoutCultureCode.Text = layout.CultureCode;
Button.ToolTip = tooltip; Button.ToolTip = tooltip;
AutomationProperties.SetHelpText(Button, tooltip); AutomationProperties.SetName(Button, tooltip);
} }
private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) private void Popup_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)

View file

@ -88,7 +88,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
{ {
WirelessIcon.Child = GetWirelessIcon(network.SignalStrength); WirelessIcon.Child = GetWirelessIcon(network.SignalStrength);
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWirelessConnected).Replace("%%NAME%%", network.Name); Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWirelessConnected).Replace("%%NAME%%", network.Name);
Button.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, Button.ToolTip as string); Button.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, Button.ToolTip as string);
} }
WirelessNetworksStackPanel.Children.Add(button); WirelessNetworksStackPanel.Children.Add(button);

View file

@ -101,7 +101,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
Button.ToolTip = tooltip; Button.ToolTip = tooltip;
PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed; PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed;
Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed; Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed;
this.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, tooltip); this.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, tooltip);
} }
private void RenderCharge(double charge, BatteryChargeStatus status) private void RenderCharge(double charge, BatteryChargeStatus status)

View file

@ -244,8 +244,8 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
ZoomLevel.Text = $"{value}%"; ZoomLevel.Text = $"{value}%";
var zoomButtonHelpText = text.Get(TextKey.BrowserWindow_ZoomLevelReset).Replace("%%ZOOM%%", value.ToString("0")); var zoomButtonName = text.Get(TextKey.BrowserWindow_ZoomLevelReset).Replace("%%ZOOM%%", value.ToString("0"));
ZoomResetButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, zoomButtonHelpText); ZoomResetButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, zoomButtonName);
}); });
} }
@ -645,13 +645,13 @@ if (typeof __SEB_focusElement === 'undefined') {
private void LoadText() private void LoadText()
{ {
DeveloperConsoleText.Text = text.Get(TextKey.BrowserWindow_DeveloperConsoleMenuItem); DeveloperConsoleText.Text = text.Get(TextKey.BrowserWindow_DeveloperConsoleMenuItem);
DeveloperConsoleButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text.Get(TextKey.BrowserWindow_DeveloperConsoleMenuItem)); DeveloperConsoleButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_DeveloperConsoleMenuItem));
FindCaseSensitiveCheckBox.Content = text.Get(TextKey.BrowserWindow_FindCaseSensitive); FindCaseSensitiveCheckBox.Content = text.Get(TextKey.BrowserWindow_FindCaseSensitive);
FindMenuText.Text = text.Get(TextKey.BrowserWindow_FindMenuItem); FindMenuText.Text = text.Get(TextKey.BrowserWindow_FindMenuItem);
FindMenuButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text.Get(TextKey.BrowserWindow_FindMenuItem)); FindMenuButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_FindMenuItem));
ZoomText.Text = text.Get(TextKey.BrowserWindow_ZoomMenuItem); ZoomText.Text = text.Get(TextKey.BrowserWindow_ZoomMenuItem);
ZoomInButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text.Get(TextKey.BrowserWindow_ZoomMenuPlus)); ZoomInButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ZoomMenuPlus));
ZoomOutButton.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, text.Get(TextKey.BrowserWindow_ZoomMenuMinus)); ZoomOutButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ZoomMenuMinus));
ReloadButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ReloadButton)); ReloadButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ReloadButton));
BackwardButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_BackwardButton)); BackwardButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_BackwardButton));
ForwardButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ForwardButton)); ForwardButton.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text.Get(TextKey.BrowserWindow_ForwardButton));