From f0879d7c38443f301fce9e6663727710702a74d0 Mon Sep 17 00:00:00 2001 From: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:09:48 -0700 Subject: [PATCH 1/5] Support AccessibilityState: Busy --- .../Composition/CompositionDynamicAutomationProvider.cpp | 7 +++++++ .../Fabric/Composition/CompositionViewComponentView.cpp | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp index 88330c1e804..2a92f6d75f5 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp @@ -370,6 +370,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 baf6a03ee7c..ac01912c2e8 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp @@ -1303,6 +1303,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); From 7d38bee4a1459bdc77e3da282a4c7b92b9ccffe3 Mon Sep 17 00:00:00 2001 From: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:09:58 -0700 Subject: [PATCH 2/5] Change files --- ...ative-windows-0d909f6f-4b48-46c7-97ec-c61c5f2b8087.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-0d909f6f-4b48-46c7-97ec-c61c5f2b8087.json 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" +} From 87089af7bf7e37fb7ff3b93b990284a46c50982d Mon Sep 17 00:00:00 2001 From: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:32:27 -0700 Subject: [PATCH 3/5] Add Testing --- .../tester/src/js/examples/View/ViewExample.windows.js | 2 +- .../windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 eef3753476c..ad552688cb8 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 @@ -565,7 +565,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/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp b/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp index 02b15b3254f..b6bed663f9a 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 @@ -411,6 +411,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); @@ -419,6 +420,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) { @@ -438,6 +440,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; From c63f1f4a0ce34bcfa671e8b4e2628c239cfeaf6c Mon Sep 17 00:00:00 2001 From: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:14:51 -0700 Subject: [PATCH 4/5] Update Snapshots --- .../test/__snapshots__/ViewComponentTest.test.ts.snap | 1 + .../test/__snapshots__/snapshotPages.test.js.snap | 1 + .../test/__snapshots__/ViewComponentTest.test.ts.snap | 1 + 3 files changed, 3 insertions(+) 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 90015e53205..b287c579a31 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,7 @@ 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", 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 56ba322bc7c..84d5c419c5d 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 @@ -77780,6 +77780,7 @@ exports[`snapshotAllPages View 22`] = ` accessibilitySetSize={1} accessibilityState={ { + "busy": true, "expanded": true, } } 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 decda6dae53..9399d081acf 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", "AutomationPositionInSet": 1, From cd1dbcc8f97d133ee2c9ad1b07f5e81fb6727ff2 Mon Sep 17 00:00:00 2001 From: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com> Date: Fri, 11 Oct 2024 11:32:04 -0700 Subject: [PATCH 5/5] Update for Leak --- .../windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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 b6bed663f9a..c258f306c22 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 @@ -456,6 +456,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; }