Skip to content

Conversation

protikbiswas100
Copy link
Contributor

@protikbiswas100 protikbiswas100 commented Oct 3, 2025

Description

The issue was that accessibilityLevel prop was not working properly in React Native Windows Fabric architecture. While the prop was defined in TypeScript and JavaScript, and the UIA (UI Automation) infrastructure existed, there was a casting problem in the native layer.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Fixes

microsoft/react-native-gallery#699

Why

heading level for accessibility is not defined

What

CompositionDynamicAutomationProvider.cpp and CompositionViewComponentView.cpp were incorrectly casting props to the base facebook::react::ViewProps class instead of the Windows-specific facebook::react::HostPlatformViewProps class where the accessibilityLevel property is actually defined.

Testing

yarn install && yarn build passed

Tested view component in playground app

699-after.mp4

Changelog

Should this change be included in the release notes: yes

Add a brief summary of the change to use in the release notes for the next release.

Microsoft Reviewers: Open in CodeFlow

@protikbiswas100
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@anupriya13
Copy link
Contributor

Description:
Resolves doesn't has issue id linked
Changelog last line is missing: summary

Please improve, thanks

Copy link
Contributor

@anupriya13 anupriya13 left a comment

Choose a reason for hiding this comment

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

Test cases?

@anupriya13 anupriya13 requested a review from Copilot October 3, 2025 10:44
Copy link
Contributor

@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 fixes a bug where the accessibilityLevel prop was not working properly in React Native Windows Fabric architecture due to incorrect casting in the native layer. The issue was that native code was casting props to the base ViewProps class instead of the Windows-specific HostPlatformViewProps class where accessibility properties are actually defined.

Key changes:

  • Fixed casting to use HostPlatformViewProps instead of ViewProps in accessibility-related code
  • Added proper null checking for the cast pointer to prevent potential crashes
  • Ensured all Windows-specific accessibility properties are accessed correctly

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp Fixed casting to HostPlatformViewProps and updated all accessibility property references to use the correct cast
vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp Fixed casting to HostPlatformViewProps and added null checking for safer property access
change/react-native-windows-48182af8-4e3f-46a5-a980-f041f56ff6ce.json Added changelog entry for the accessibility fix

@sundaramramaswamy
Copy link
Contributor

sundaramramaswamy commented Oct 3, 2025

PR title should be a short summary in imperative mood (Fix, not Fixing or Fixed).

A good commit message

  • captures the why (context) not how / what (which git diff can always show)
  • is succinct.

Please refer How to Write a Git Commit Message.

@protikbiswas100
Copy link
Contributor Author

Add a brief summary of the change to use in the release notes for the next release.

Add a brief summary of the change to use in the release notes for the next release.
THis line is already added, which line are you referring to

@protikbiswas100
Copy link
Contributor Author

protikbiswas100 commented Oct 3, 2025

PR title should be a short summary in imperative mood (Fix, not Fixing or Fixed).

A good commit message

  • captures the why (context) not how / what (which git diff can always show)
  • is succinct.

Please refer How to Write a Git Commit Message.

The commit message starts with Fix

@protikbiswas100
Copy link
Contributor Author

Test cases?
Added testcase on accessibilityLevel

protikbiswas100 and others added 2 commits October 3, 2025 17:11
…micAutomationProvider.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ComponentView.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@protikbiswas100
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@anupriya13
Copy link
Contributor

Add a brief summary of the change to use in the release notes for the next release.

Add a brief summary of the change to use in the release notes for the next release.

THis line is already added, which line are you referring to

A line of actual summary should be added after that template line which is missing.

The script picks up summary of line after that template line.

@protikbiswas100 protikbiswas100 changed the title Fixing heading level for accessibility Fix for heading level for accessibility Oct 6, 2025
@protikbiswas100 protikbiswas100 marked this pull request as draft October 6, 2025 08:12
@protikbiswas100
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants