Primary APIs:
AutomationProperties (Name, AutomationId, HelpText, LabeledBy, LiveSetting)Reference docs:
23-accessibility-and-automation.md60-automation-properties-and-attached-behavior-patterns.md12-html-css-interaction-states-focus-gestures-and-input-ux.md| Web accessibility | Avalonia mapping |
|---|---|
aria-label |
AutomationProperties.Name |
aria-describedby |
AutomationProperties.HelpText |
aria-live |
AutomationProperties.LiveSetting |
element id for tests |
AutomationProperties.AutomationId |
HTML:
<button aria-label="Refresh analytics" aria-describedby="refreshHelp">↻</button>
<small id="refreshHelp">Downloads latest data</small>
Avalonia:
<Button Content="Refresh"
AutomationProperties.Name="Refresh analytics"
AutomationProperties.HelpText="Downloads latest data"
AutomationProperties.AutomationId="RefreshAnalyticsButton" />
HTML/CSS uses DOM order + tabindex; Avalonia uses visual tree ordering plus focusability/keyboard navigation configuration.
Practical mapping:
Web pattern:
@media (prefers-reduced-motion: reduce) {
* { animation: none !important; transition: none !important; }
}
Avalonia pattern:
reduced-motion app/root class,<Style Selector="*.reduced-motion Border.animated-card">
<Setter Property="Transitions">
<Transitions />
</Setter>
</Style>
<StackPanel Spacing="10">
<TextBlock Text="Notifications" FontWeight="SemiBold" />
<ToggleSwitch Content="Enable email alerts"
IsChecked="{CompiledBinding EmailAlertsEnabled}"
AutomationProperties.AutomationId="EmailAlertsToggle"
AutomationProperties.HelpText="Sends alerts for important account events" />
<Button Content="Save settings"
Command="{CompiledBinding SaveCommand}"
AutomationProperties.Name="Save notification settings"
AutomationProperties.AutomationId="SaveSettingsButton" />
</StackPanel>
using Avalonia.Controls;
using Avalonia.Automation;
using Avalonia.Media;
var panel = new StackPanel { Spacing = 10 };
panel.Children.Add(new TextBlock { Text = "Notifications", FontWeight = FontWeight.SemiBold });
var emailToggle = new ToggleSwitch { Content = "Enable email alerts" };
AutomationProperties.SetAutomationId(emailToggle, "EmailAlertsToggle");
AutomationProperties.SetHelpText(emailToggle, "Sends alerts for important account events");
panel.Children.Add(emailToggle);
var saveButton = new Button { Content = "Save settings" };
AutomationProperties.SetName(saveButton, "Save notification settings");
AutomationProperties.SetAutomationId(saveButton, "SaveSettingsButton");
panel.Children.Add(saveButton);
// Reduced motion mode can be represented by a class toggle at root scope.
panel.Classes.Set("reduced-motion", true);