feat(accessibility): add accessibility labels to tweaks ui (#3731)

This commit is contained in:
makhlwf 2025-12-01 21:45:58 +02:00 committed by GitHub
parent 5369d9d99b
commit 2b68976e7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -156,6 +156,7 @@ function Invoke-WPFUIElements {
$checkBox.Name = $entryInfo.Name
$checkBox.HorizontalAlignment = "Right"
$checkBox.UseLayoutRounding = $true
[System.Windows.Automation.AutomationProperties]::SetName($checkBox, $entryInfo.Content)
$dockPanel.Children.Add($checkBox) | Out-Null
$checkBox.Style = $ColorfulToggleSwitchStyle
@ -191,6 +192,7 @@ function Invoke-WPFUIElements {
$toggleButton.ToolTip = $entryInfo.Description
$toggleButton.HorizontalAlignment = "Left"
$toggleButton.Style = $ToggleButtonStyle
[System.Windows.Automation.AutomationProperties]::SetName($toggleButton, $entryInfo.Content[0])
$toggleButton.Tag = @{
contentOn = if ($entryInfo.Content.Count -ge 1) { $entryInfo.Content[0] } else { "" }
@ -232,6 +234,7 @@ function Invoke-WPFUIElements {
$comboBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "ButtonMargin")
$comboBox.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize")
$comboBox.UseLayoutRounding = $true
[System.Windows.Automation.AutomationProperties]::SetName($comboBox, $entryInfo.Content)
foreach ($comboitem in ($entryInfo.ComboItems -split " ")) {
$comboBoxItem = New-Object Windows.Controls.ComboBoxItem
@ -273,6 +276,7 @@ function Invoke-WPFUIElements {
$baseWidth = [int]$entryInfo.ButtonWidth
$button.Width = [math]::Max($baseWidth, 350)
}
[System.Windows.Automation.AutomationProperties]::SetName($button, $entryInfo.Content)
$itemsControl.Items.Add($button) | Out-Null
$sync[$entryInfo.Name] = $button
@ -303,6 +307,7 @@ function Invoke-WPFUIElements {
$radioButton.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize")
$radioButton.ToolTip = $entryInfo.Description
$radioButton.UseLayoutRounding = $true
[System.Windows.Automation.AutomationProperties]::SetName($radioButton, $entryInfo.Content)
if ($entryInfo.Checked -eq $true) {
$radioButton.IsChecked = $true
@ -324,6 +329,7 @@ function Invoke-WPFUIElements {
$checkBox.ToolTip = $entryInfo.Description
$checkBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin")
$checkBox.UseLayoutRounding = $true
[System.Windows.Automation.AutomationProperties]::SetName($checkBox, $entryInfo.Content)
if ($entryInfo.Checked -eq $true) {
$checkBox.IsChecked = $entryInfo.Checked
}