Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix accessibilityState to support states not being set #11792

Merged
merged 12 commits into from
Jul 28, 2023
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix accessibilityState to support states not being set",
"packageName": "@react-native-windows/automation-commands",
"email": "jthysell@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Fix accessibilityState to support states not being set",
"packageName": "react-native-windows",
"email": "jthysell@microsoft.com",
"dependentChangeType": "patch"
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@
"lodash": "^4.17.15"
},
"resolutions": {
"convert-source-map": "^2.0.0",
"kind-of": "6.0.3",
"glob-parent": "^5.1.2",
"node-notifier": "^9.0.0",
"safe-buffer": "^5.2.1",
"set-value": "^4.0.1",
"strip-ansi": "^6.0.1",
"**/parse-url/normalize-url": "^4.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,7 @@ function removeNonDeterministicProps(element: UIElement) {
* Removes noise from snapshot by removing properties with the default value
*/
function removeDefaultProps(element: UIElement) {
const defaultValues: [string, unknown][] = [
['Tooltip', null],
['AutomationLevel', -1],
['AutomationPositionInSet', -1],
['AutomationSizeOfSet', -1],
];
const defaultValues: [string, unknown][] = [['Tooltip', null]];

defaultValues.forEach(([propname, defaultValue]) => {
if (element[propname] === defaultValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

exports[`ButtonTests Buttons can be disabled 1`] = `
{
"AccessibilityRole": "Button",
"AccessibilityStateDisabled": true,
"AutomationId": "disabled_button",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -93,6 +95,7 @@ exports[`ButtonTests Buttons can be disabled 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityStateDisabled": true,
"Clip": null,
"FlowDirection": "LeftToRight",
"Foreground": "#5C000000",
Expand Down Expand Up @@ -122,6 +125,7 @@ exports[`ButtonTests Buttons can be disabled 1`] = `

exports[`ButtonTests Buttons can have accessibility labels 1`] = `
{
"AccessibilityRole": "Button",
"AutomationId": "accessibilityLabel_button",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -242,6 +246,7 @@ exports[`ButtonTests Buttons can have accessibility labels 1`] = `

exports[`ButtonTests Buttons can have accessibility props 1`] = `
{
"AccessibilityRole": "Button",
"AutomationId": "accessibility_props",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -362,6 +367,8 @@ exports[`ButtonTests Buttons can have accessibility props 1`] = `

exports[`ButtonTests Buttons can have accessibility states 1`] = `
{
"AccessibilityRole": "Button",
"AccessibilityStateDisabled": true,
"AutomationId": "accessibilityState_button",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -453,6 +460,7 @@ exports[`ButtonTests Buttons can have accessibility states 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityStateDisabled": true,
"Clip": null,
"FlowDirection": "LeftToRight",
"Foreground": "#5C000000",
Expand Down Expand Up @@ -482,6 +490,7 @@ exports[`ButtonTests Buttons can have accessibility states 1`] = `

exports[`ButtonTests Buttons can have custom colors 1`] = `
{
"AccessibilityRole": "Button",
"AutomationId": "cancel_button",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -621,6 +630,7 @@ exports[`ButtonTests Buttons can have their accessibility and keyboard focus dis
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Button",
"AutomationId": "accessibility_props",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -738,6 +748,7 @@ exports[`ButtonTests Buttons can have their accessibility and keyboard focus dis
],
},
{
"AccessibilityRole": "Button",
"AutomationId": "accessibility_props",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -855,6 +866,7 @@ exports[`ButtonTests Buttons can have their accessibility and keyboard focus dis
],
},
{
"AccessibilityRole": "Button",
"AutomationId": "accessibility_props",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -972,6 +984,7 @@ exports[`ButtonTests Buttons can have their accessibility and keyboard focus dis
],
},
{
"AccessibilityRole": "Button",
"AutomationId": "accessibility_props",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -1094,6 +1107,7 @@ exports[`ButtonTests Buttons can have their accessibility and keyboard focus dis

exports[`ButtonTests Buttons have default styling 1`] = `
{
"AccessibilityRole": "Button",
"AutomationId": "button_default_styling",
"Background": null,
"BorderBrush": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ exports[`FlyoutTests Flyout 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Button",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down Expand Up @@ -398,6 +399,7 @@ exports[`FlyoutTests Flyout 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Button",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down Expand Up @@ -534,6 +536,7 @@ exports[`FlyoutTests Flyout 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Button",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`LegacyControlStyleTest ControlStyleTestWithRegularBorder #2 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Switch",
"Background": "#33E1E1E1",
"BorderBrush": "#55FF00FF",
"BorderThickness": "1,1,1,1",
Expand Down Expand Up @@ -655,6 +656,7 @@ exports[`LegacyControlStyleTest ControlStyleTestWithRegularBorder 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Switch",
"Background": "#33E1E1E1",
"BorderBrush": "#55FF00FF",
"BorderThickness": "1,1,1,1",
Expand Down Expand Up @@ -1289,6 +1291,7 @@ exports[`LegacyControlStyleTest ControlStyleTestWithRoundBorder 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Switch",
"Background": "#33000000",
"BorderBrush": "#5500FF00",
"BorderThickness": "10,10,10,10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`LegacyImageTest ImageRTLTest 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Image",
"Left": 0,
"Top": 0,
"XamlType": "Windows.UI.Xaml.DependencyObject",
Expand Down Expand Up @@ -50,6 +51,7 @@ exports[`LegacyImageTest ImageWithBorderTest 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Image",
"Left": 10,
"Top": 10,
"XamlType": "Windows.UI.Xaml.DependencyObject",
Expand Down Expand Up @@ -79,6 +81,7 @@ exports[`LegacyImageTest ImageWithoutBorderTest 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Image",
"Left": 0,
"Top": 0,
"XamlType": "Windows.UI.Xaml.DependencyObject",
Expand Down Expand Up @@ -108,6 +111,7 @@ exports[`LegacyImageTest ImageWithoutBorderTestOneMoreClick 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Image",
"Left": 0,
"Top": 0,
"XamlType": "Windows.UI.Xaml.DependencyObject",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ exports[`PopupTests Popups can be anchored 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Button",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down Expand Up @@ -412,6 +413,7 @@ exports[`PopupTests Popups can have customized accessibility 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Button",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down Expand Up @@ -552,6 +554,7 @@ exports[`PopupTests Popups can have different placement 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Button",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ exports[`PressableTests Pressables can have delayed event handlers 1`] = `

exports[`PressableTests Pressables can have event handlers 1`] = `
{
"AccessibilityRole": "Button",
"AutomationId": "pressable_feedback_events_button",
"Background": null,
"BorderBrush": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3589,6 +3589,7 @@ exports[`ScrollViewTests ScrollViews can scroll an item list horizontally 1`] =

exports[`ScrollViewTests ScrollViews can scroll an item list vertically 1`] = `
{
"AccessibilityRole": "Unknown",
"AutomationId": "scroll_vertical",
"Background": "#FFEEEEEE",
"BorderBrush": "#00FFFFFF",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`SwitchTests Change events can be detected, event bottom 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "event-switch-bottom",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -229,6 +230,7 @@ exports[`SwitchTests Change events can be detected, event bottom 1`] = `

exports[`SwitchTests Change events can be detected, event regression top 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "event-switch-regression-top",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -456,6 +458,7 @@ exports[`SwitchTests Change events can be detected, event regression top 1`] = `

exports[`SwitchTests Change events can be detected, event top 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "event-switch-top",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -683,6 +686,7 @@ exports[`SwitchTests Change events can be detected, event top 1`] = `

exports[`SwitchTests Change events can be detected, events regression bottom 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "event-switch-regression-bottom",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -910,6 +914,7 @@ exports[`SwitchTests Change events can be detected, events regression bottom 1`]

exports[`SwitchTests Controlled switch 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "controlled-switch",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -1137,6 +1142,7 @@ exports[`SwitchTests Controlled switch 1`] = `

exports[`SwitchTests Custom colors can be provided, initial false 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "initial-false-switch",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -1364,6 +1370,7 @@ exports[`SwitchTests Custom colors can be provided, initial false 1`] = `

exports[`SwitchTests Custom colors can be provided, initial true 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "initial-true-switch",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -1591,6 +1598,7 @@ exports[`SwitchTests Custom colors can be provided, initial true 1`] = `

exports[`SwitchTests Switches can be disabled, initial false 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "disabled-initial-off",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -1818,6 +1826,7 @@ exports[`SwitchTests Switches can be disabled, initial false 1`] = `

exports[`SwitchTests Switches can be disabled, initial true 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "disabled-initial-on",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -2045,6 +2054,7 @@ exports[`SwitchTests Switches can be disabled, initial true 1`] = `

exports[`SwitchTests Switches can be set to true/false, initial false 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "on-off-initial-off",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -2272,6 +2282,7 @@ exports[`SwitchTests Switches can be set to true/false, initial false 1`] = `

exports[`SwitchTests Switches can be set to true/false, initial true 1`] = `
{
"AccessibilityRole": "Switch",
"AutomationId": "on-off-initial-on",
"Background": null,
"BorderBrush": null,
Expand Down Expand Up @@ -2536,6 +2547,7 @@ exports[`SwitchTests Switches can have customized accessibility 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Switch",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down Expand Up @@ -2759,6 +2771,7 @@ exports[`SwitchTests Switches can have customized accessibility 1`] = `
],
},
{
"AccessibilityRole": "Switch",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down Expand Up @@ -3002,6 +3015,7 @@ exports[`SwitchTests Switches can have customized accessibility 1`] = `
"XamlType": "Microsoft.ReactNative.ViewPanel",
"children": [
{
"AccessibilityRole": "Switch",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down Expand Up @@ -3225,6 +3239,7 @@ exports[`SwitchTests Switches can have customized accessibility 1`] = `
],
},
{
"AccessibilityRole": "Switch",
"Background": null,
"BorderBrush": null,
"BorderThickness": "0,0,0,0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ exports[`ViewTests Views can have a custom nativeID 1`] = `

exports[`ViewTests Views can have accessibility customization 1`] = `
{
"AccessibilityRole": "Unknown",
"AutomationId": "accessibility",
"Background": null,
"BorderBrush": null,
Expand Down
Loading