Skip to content

[Fabric] Implementation of accessibiltyAnnotation and adding support for IAnnotationProvider #14626

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

vineethkuttan
Copy link
Contributor

@vineethkuttan vineethkuttan commented Apr 29, 2025

Description

Type of Change

  • New feature (non-breaking change which adds functionality)

Why

Implementing accessibilityAnnotation for windows platform and adding support for IAnnotationProvider will help in providing accessibility information to the screen reader.

Resolves [#14531 ]

What

Added new Proivder CompositionAnnotationProvider to the project

Screenshots

Before Implementation:
BeforeAnnotatepng

After Implementation:

AfterAnnotate

Testing

Tested in Playground , added test cases for the same

Optional: Describe the tests that you ran locally to verify your changes.

Changelog

Should this change be included in the release notes: yes

Added Support for the IAnnotationProvider

Microsoft Reviewers: Open in CodeFlow

@vineethkuttan vineethkuttan changed the title [Fabric] Implememtation of accessibiltyAnnotation and adding support for IAnnotationProvider [Fabric] Implementation of accessibiltyAnnotation and adding support for IAnnotationProvider Apr 29, 2025
@vineethkuttan vineethkuttan added enhancement Area: Accessibility Partner: Office Area: Fabric Support Facebook Fabric Workstream: Accessibility Ensure RNW Fabric apps are properly accessible. labels Apr 29, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric label Apr 29, 2025
@vineethkuttan vineethkuttan marked this pull request as ready for review April 29, 2025 15:12
@vineethkuttan vineethkuttan requested a review from a team as a code owner April 29, 2025 15:12
@vineethkuttan vineethkuttan force-pushed the impAccessibilityAnnotation2.0 branch from 80b98c3 to 83f0fab Compare April 30, 2025 08:52
@vineethkuttan vineethkuttan requested a review from acoates-ms May 1, 2025 03:05
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for a new accessibility annotation feature on Windows by adding an accessibilityAnnotation property and a new CompositionAnnotationProvider. Key changes include:

  • Adding the accessibilityAnnotation attribute in JavaScript and native view property configuration.
  • Updating HostPlatformViewProps (.h/.cpp) to handle the new accessibilityAnnotation prop.
  • Implementing the CompositionAnnotationProvider and updating UI Automation helper functions and test samples to support the annotation functionality.

Reviewed Changes

Copilot reviewed 14 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vnext/src-win/Libraries/NativeComponent/BaseViewConfig.windows.js Added the accessibilityAnnotation attribute to the valid attributes list.
vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.{h,cpp} Introduced a new optional AccessibilityAnnotation property and updated raw property conversion.
vnext/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.{h,cpp} Introduced GetAnnotationTypeId and accessibilityAnnotationHasValue to support annotation logic.
vnext/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.{h,cpp} Added a new provider for handling accessibility annotation details in UIA.
CompositionDynamicAutomationProvider.{cpp,h} Updated provider to initialize and return the new annotation provider when applicable.
packages/playground/Samples/text.tsx & tester/example files Updated sample and test code to include annotation examples.
Files not reviewed (5)
  • change/react-native-windows-a703b417-fd1e-4499-ae0b-a4ce670db2bb.json: Language not supported
  • packages/e2e-test-app-fabric/test/snapshots/AccessibilityTest.test.ts.snap: Language not supported
  • packages/e2e-test-app-fabric/test/snapshots/snapshotPages.test.js.snap: Language not supported
  • vnext/Shared/Shared.vcxitems: Language not supported
  • vnext/Shared/Shared.vcxitems.filters: Language not supported
Comments suppressed due to low confidence (1)

packages/@react-native-windows/tester/src/js/examples-win/Accessibility/AccessibilityExampleWindows.tsx:26

  • [nitpick] There appears to be a typo in the accessibilityLabel value, 'Annotation Checkc' might be intended as 'Annotation Check'.
accessibilityLabel="Annotation Checkc"

@@ -36,6 +37,12 @@ CompositionDynamicAutomationProvider::CompositionDynamicAutomationProvider(
strongView.as<winrt::Microsoft::ReactNative::Composition::ComponentView>(), this)
.try_as<ITextProvider2>();
}

if (strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>()) {
m_annotationProvider = winrt::make<CompositionAnnotationProvider>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we file a followup issue to make m_annotationProvider and m_textProvider be delay created. If the consuming UIA agent does not request these patterns we shouldn't create these providers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Accessibility Area: Fabric Support Facebook Fabric enhancement New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric Partner: Office Workstream: Accessibility Ensure RNW Fabric apps are properly accessible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants