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

Add Support for AccessibilityState:Busy #13952

Merged
merged 6 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Support AccessibilityState: Busy",
"packageName": "react-native-windows",
"email": "34109996+chiaramooney@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77780,6 +77780,7 @@ exports[`snapshotAllPages View 22`] = `
accessibilitySetSize={1}
accessibilityState={
{
"busy": true,
"expanded": true,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ winrt::Windows::Data::Json::JsonObject DumpUIATreeRecurse(
int positionInSet = 0;
int sizeOfSet = 0;
LiveSetting liveSetting = LiveSetting::Off;
BSTR itemStatus;
chiaramooney marked this conversation as resolved.
Show resolved Hide resolved

pTarget->get_CurrentAutomationId(&automationId);
pTarget->get_CurrentControlType(&controlType);
Expand All @@ -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<void **>(&pTarget4));
if (SUCCEEDED(hr) && pTarget4) {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading