Skip to content

Commit

Permalink
[Fabric] Add accessible Prop Functionality to Remove/Add Elements fro…
Browse files Browse the repository at this point in the history
…m Content Tree (#11719)

* Add accessible Functionality

* Change files

* Add accessibilityRole None

* Format
  • Loading branch information
chiaramooney authored Jun 8, 2023
1 parent cdd75ae commit 2a3578d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Add accessible Functionality",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT
pRetVal->boolVal = !props->accessibilityState.disabled ? VARIANT_TRUE : VARIANT_FALSE;
break;
}
case UIA_IsContentElementPropertyId: {
pRetVal->vt = VT_BOOL;
pRetVal->boolVal = (props->accessible && props->accessibilityRole != "none") ? VARIANT_TRUE : VARIANT_FALSE;
break;
}
case UIA_IsControlElementPropertyId: {
pRetVal->vt = VT_BOOL;
pRetVal->boolVal = (props->accessible && props->accessibilityRole != "none") ? VARIANT_TRUE : VARIANT_FALSE;
break;
}
}

return hr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,18 @@ void CompositionBaseComponentView::updateAccessibilityProps(
winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
provider, UIA_NamePropertyId, oldViewProps.accessibilityLabel, newViewProps.accessibilityLabel);

winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
provider,
UIA_IsContentElementPropertyId,
(oldViewProps.accessible && oldViewProps.accessibilityRole != "none"),
(newViewProps.accessible && newViewProps.accessibilityRole != "none"));

winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
provider,
UIA_IsControlElementPropertyId,
(oldViewProps.accessible && oldViewProps.accessibilityRole != "none"),
(newViewProps.accessible && newViewProps.accessibilityRole != "none"));

winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
provider,
UIA_IsEnabledPropertyId,
Expand Down

0 comments on commit 2a3578d

Please sign in to comment.