Skip to content

Commit f457fd3

Browse files
committed
add accessiblity states to xaml dump
1 parent 92457d3 commit f457fd3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/@react-native-windows/automation-commands/src/dumpVisualTree.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ function removeDefaultProps(element: UIElement) {
118118
['AutomationLevel', -1],
119119
['AutomationPositionInSet', -1],
120120
['AutomationSizeOfSet', -1],
121+
['AccessibilityRole', null],
122+
['AccessibilityStateSelected', null],
123+
['AccessibilityStateDisabled', null],
124+
['AccessibilityStateChecked', null],
125+
['AccessibilityStateBusy', null],
126+
['AccessibilityStateExpanded', null],
121127
];
122128

123129
defaultValues.forEach(([propname, defaultValue]) => {

packages/e2e-test-app/windows/RNTesterApp/MainPage.xaml.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ JsonObject DumpVisualTree(JsonValue payload)
7878
new AttachedProperty() { Name = "AutomationLevel", Property = Windows.UI.Xaml.Automation.AutomationProperties.LevelProperty },
7979
new AttachedProperty() { Name = "AutomationSizeOfSet", Property = Windows.UI.Xaml.Automation.AutomationProperties.SizeOfSetProperty },
8080
new AttachedProperty() { Name = "AutomationPositionInSet", Property = Windows.UI.Xaml.Automation.AutomationProperties.PositionInSetProperty },
81+
new AttachedProperty() { Name = "AccessibilityRole", Property = Microsoft.ReactNative.DynamicAutomationProperties.AccessibilityRoleProperty },
82+
new AttachedProperty() { Name = "AccessibilityStateSelected", Property = Microsoft.ReactNative.DynamicAutomationProperties.AccessibilityStateSelectedProperty },
83+
new AttachedProperty() { Name = "AccessibilityStateDisabled", Property = Microsoft.ReactNative.DynamicAutomationProperties.AccessibilityStateDisabledProperty },
84+
new AttachedProperty() { Name = "AccessibilityStateChecked", Property = Microsoft.ReactNative.DynamicAutomationProperties.AccessibilityStateCheckedProperty },
85+
new AttachedProperty() { Name = "AccessibilityStateBusy", Property = Microsoft.ReactNative.DynamicAutomationProperties.AccessibilityStateBusyProperty },
86+
new AttachedProperty() { Name = "AccessibilityStateExpanded", Property = Microsoft.ReactNative.DynamicAutomationProperties.AccessibilityStateExpandedProperty },
8187
};
8288
var rootDump = VisualTreeDumper.DumpTree(this, null, additionalProperties, attachedProperties);
8389
var element = VisualTreeDumper.FindElementByAutomationId(JsonObject.Parse(rootDump), accessibilityId);
@@ -115,7 +121,8 @@ async Task LoopServer(Server server)
115121
try
116122
{
117123
await server.ProcessAllClientRequests(8603, TimeSpan.FromMilliseconds(50));
118-
} catch( Exception ex)
124+
}
125+
catch (Exception ex)
119126
{
120127
}
121128
}

0 commit comments

Comments
 (0)