diff --git a/change/react-native-windows-0d909f6f-4b48-46c7-97ec-c61c5f2b8087.json b/change/react-native-windows-0d909f6f-4b48-46c7-97ec-c61c5f2b8087.json new file mode 100644 index 00000000000..db5044f8113 --- /dev/null +++ b/change/react-native-windows-0d909f6f-4b48-46c7-97ec-c61c5f2b8087.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Support AccessibilityState: Busy", + "packageName": "react-native-windows", + "email": "34109996+chiaramooney@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/@react-native-windows/tester/src/js/examples/View/ViewExample.windows.js b/packages/@react-native-windows/tester/src/js/examples/View/ViewExample.windows.js index a54a57cbbd4..2192d7c3ebe 100644 --- a/packages/@react-native-windows/tester/src/js/examples/View/ViewExample.windows.js +++ b/packages/@react-native-windows/tester/src/js/examples/View/ViewExample.windows.js @@ -477,7 +477,7 @@ class AccessibilityExample extends React.Component< {name: 'expand', label: 'expand'}, {name: 'collapse', label: 'collapse'}, ]} - accessibilityState={{expanded: this.state.expanded}} + accessibilityState={{expanded: this.state.expanded, busy: true}} accessibilityPosInSet={1} accessibilitySetSize={1} accessibilityLiveRegion='polite' diff --git a/packages/e2e-test-app-fabric/test/__snapshots__/ViewComponentTest.test.ts.snap b/packages/e2e-test-app-fabric/test/__snapshots__/ViewComponentTest.test.ts.snap index 7d13467736b..0abd15d493c 100644 --- a/packages/e2e-test-app-fabric/test/__snapshots__/ViewComponentTest.test.ts.snap +++ b/packages/e2e-test-app-fabric/test/__snapshots__/ViewComponentTest.test.ts.snap @@ -1097,6 +1097,8 @@ exports[`View Tests Views can have customized accessibility 1`] = ` "ExpandCollapsePattern.ExpandCollapseState": "Expanded", "HelpText": "Accessibility Hint", "IsKeyboardFocusable": true, + "ItemStatus": "Busy", + "LiveSetting": "Polite", "LocalizedControlType": "button", "Name": "A View with accessibility values", "__Children": [ diff --git a/packages/e2e-test-app-fabric/test/__snapshots__/snapshotPages.test.js.snap b/packages/e2e-test-app-fabric/test/__snapshots__/snapshotPages.test.js.snap index 3c702bc34e8..3009afbce7b 100644 --- a/packages/e2e-test-app-fabric/test/__snapshots__/snapshotPages.test.js.snap +++ b/packages/e2e-test-app-fabric/test/__snapshots__/snapshotPages.test.js.snap @@ -83774,6 +83774,7 @@ exports[`snapshotAllPages View 20`] = ` accessibilitySetSize={1} accessibilityState={ { + "busy": true, "expanded": true, } } diff --git a/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp b/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp index 540aa5beb68..3037f885ff1 100644 --- a/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp +++ b/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp @@ -405,6 +405,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse( int positionInSet = 0; int sizeOfSet = 0; LiveSetting liveSetting = LiveSetting::Off; + BSTR itemStatus; pTarget->get_CurrentAutomationId(&automationId); pTarget->get_CurrentControlType(&controlType); @@ -413,6 +414,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse( pTarget->get_CurrentIsKeyboardFocusable(&isKeyboardFocusable); pTarget->get_CurrentLocalizedControlType(&localizedControlType); pTarget->get_CurrentName(&name); + pTarget->get_CurrentItemStatus(&itemStatus); IUIAutomationElement4 *pTarget4; HRESULT hr = pTarget->QueryInterface(__uuidof(IUIAutomationElement4), reinterpret_cast(&pTarget4)); if (SUCCEEDED(hr) && pTarget4) { @@ -432,6 +434,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse( InsertIntValueIfNotDefault(result, L"PositionInSet", positionInSet); InsertIntValueIfNotDefault(result, L"SizeofSet", sizeOfSet); InsertLiveSettingValueIfNotDefault(result, L"LiveSetting", liveSetting); + InsertStringValueIfNotEmpty(result, L"ItemStatus", itemStatus); DumpUIAPatternInfo(pTarget, result); IUIAutomationElement *pChild; @@ -447,6 +450,11 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse( if (children.Size() > 0) { result.Insert(L"__Children", children); } + ::SysFreeString(automationId); + ::SysFreeString(helpText); + ::SysFreeString(localizedControlType); + ::SysFreeString(name); + ::SysFreeString(itemStatus); return result; } diff --git a/packages/e2e-test-app/test/__snapshots__/ViewComponentTest.test.ts.snap b/packages/e2e-test-app/test/__snapshots__/ViewComponentTest.test.ts.snap index a39b8edc3e5..49282ea7db5 100644 --- a/packages/e2e-test-app/test/__snapshots__/ViewComponentTest.test.ts.snap +++ b/packages/e2e-test-app/test/__snapshots__/ViewComponentTest.test.ts.snap @@ -363,6 +363,7 @@ exports[`ViewTests Views can have a custom nativeID 1`] = ` exports[`ViewTests Views can have accessibility customization 1`] = ` { "AccessibilityRole": "Button", + "AccessibilityStateBusy": true, "AccessibilityStateExpanded": true, "AutomationId": "accessibility", "Background": null, diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp index 23559e13196..a3d0d816a2e 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp @@ -358,6 +358,13 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT pRetVal->lVal = GetLiveSetting(props->accessibilityLiveRegion); break; } + case UIA_ItemStatusPropertyId: { + pRetVal->vt = VT_BSTR; + pRetVal->bstrVal = (props->accessibilityState.has_value() && props->accessibilityState->busy) + ? SysAllocString(L"Busy") + : SysAllocString(L""); + break; + } } return hr; diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp index a66b878edfc..ad07315615d 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp @@ -1309,6 +1309,12 @@ void ComponentView::updateAccessibilityProps( !(oldViewProps.accessibilityState && oldViewProps.accessibilityState->disabled), !(newViewProps.accessibilityState && newViewProps.accessibilityState->disabled)); + winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty( + m_uiaProvider, + UIA_IsEnabledPropertyId, + !(oldViewProps.accessibilityState && oldViewProps.accessibilityState->busy), + !(newViewProps.accessibilityState && newViewProps.accessibilityState->busy)); + winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty( m_uiaProvider, UIA_ControlTypePropertyId, oldViewProps.accessibilityRole, newViewProps.accessibilityRole);