Skip to content

[0.85] Raise UIA events for selection changes - #16447

Open
anuagragith wants to merge 5 commits into
microsoft:0.85-stablefrom
anuagragith:fix/selection-item-automation-events-0.85
Open

anuagragith wants to merge 5 commits into
microsoft:0.85-stablefrom
anuagragith:fix/selection-item-automation-events-0.85

Conversation

@anuagragith

@anuagragith anuagragith commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Description

Backports #16446 to .85-stable for the RNW 0.85 Gallery accessibility release.

Type of Change

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

Why

Narrator does not receive UI Automation notifications when �ccessibilityState.selected changes. The Gallery supplies the correct Selection/SelectionItem accessibility state, so the framework must emit the selected-property and SelectionItem events.

Resolves ADO 63972808 for the RNW 0.85 release line.

What

Clean cherry-pick of the main fix onto .85-stable.

Screenshots

Not applicable; this change affects UI Automation events.

Testing

The backport cherry-picked without conflicts. On the main fix, UiaHelpersTests.* passed 9/9, changed production translation units compiled, and formatting/diff checks passed.

Changelog

Yes.

Raise UI Automation selection events when �ccessibilityState.selected changes.

Microsoft Reviewers: Open in CodeFlow

Notify UI Automation clients when accessibilityState.selected changes and raise SelectionItem events according to the container's selection mode and selected item count.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0f63ea4f-a16b-4fa3-b141-785aec89b5e4
Copilot AI balanced review requested due to automatic review settings September 16, 2026 23:41
@anuagragith
anuagragith requested a review from a team as a code owner September 16, 2026 23:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Selection events may not reach custom automation-provider wrappers.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Backports UI Automation selection-change notifications to the RNW 0.85 release line.

Changes:

  • Raises selected-property and SelectionItem UIA events.
  • Traverses mounted selection hierarchies.
  • Adds tests, project integration, and changelog metadata.
File summaries
File Description
vnext/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h Declares selection helpers.
vnext/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp Implements selection traversal and event raising.
vnext/Microsoft.ReactNative/Fabric/Composition/SelectionItemAutomationEvent.h Adds selection event logic.
vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp Emits UIA notifications on selection changes.
vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h Updates selection state handling.
vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp Computes current selections dynamically.
vnext/Microsoft.ReactNative.IntegrationTests/UiaHelpersTests.cpp Tests selection behavior and event classification.
vnext/Microsoft.ReactNative.IntegrationTests/Microsoft.ReactNative.IntegrationTests.vcxproj.filters Adds test project filters.
vnext/Microsoft.ReactNative.IntegrationTests/Microsoft.ReactNative.IntegrationTests.vcxproj Includes the new tests.
change/react-native-windows-22b1e2a3-5ecc-4c5c-b127-e625595c8026.json Records the changelog entry.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1289 to +1291
if (m_innerAutomationProvider) {
winrt::Microsoft::ReactNative::implementation::RaiseSelectionItemAutomationEvent(
m_innerAutomationProvider.get(), newSelected.value_or(false));
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0f63ea4f-a16b-4fa3-b141-785aec89b5e4
Copilot AI review requested due to automatic review settings September 17, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Selection events currently use the inner provider instead of the exposed provider, so custom automation peers may not receive them.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.

Comment on lines +1291 to +1292
winrt::Microsoft::ReactNative::implementation::RaiseSelectionItemAutomationEvent(
m_innerAutomationProvider.get(), newSelected.value_or(false), root && root->GetFocusedComponent() == *this);
Copilot AI review requested due to automatic review settings September 17, 2026 19:56
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0f63ea4f-a16b-4fa3-b141-785aec89b5e4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Selection events must be raised on the outer provider returned by EnsureUiaProvider() to support custom automation peers.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp:1291

  • This raises the selection event on m_innerAutomationProvider, bypassing the provider returned by EnsureUiaProvider(). When a component supplies a custom automation peer, EnsureUiaProvider() returns that wrapper while m_innerAutomationProvider remains only the default provider (see ComponentView::EnsureUiaProvider); UIA clients listen to the wrapper, so these selection events are not delivered for custom peers. Keep the inner provider for finding the selection container, but raise the event on the outer provider returned by EnsureUiaProvider() (including the remaining-item provider in the single-item transition).
  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0f63ea4f-a16b-4fa3-b141-785aec89b5e4
Copilot AI review requested due to automatic review settings September 17, 2026 20:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

SelectionItem events may be raised from the inner provider instead of the exposed custom provider.

Review details

Suppressed comments (1)

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp:1292

  • This raises the SelectionItem event on m_innerAutomationProvider, but EnsureUiaProvider() can return a custom automation-peer wrapper while m_innerAutomationProvider remains the default provider. In that case the event is sourced from a provider that is not the one exposed in the UIA tree, so custom peers will not receive/identify selection changes correctly. Pass the outer provider to the event-raising helper (use the inner provider only to inspect the selection container), matching the EnsureUiaProvider() path used for the property change above.
    if (m_innerAutomationProvider) {
      auto root = rootComponentView();
      winrt::Microsoft::ReactNative::implementation::RaiseSelectionItemAutomationEvent(
          m_innerAutomationProvider.get(), newSelected.value_or(false), root && root->GetFocusedComponent() == *this);
  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.

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.

2 participants