diff --git a/change/react-native-windows-b55776cc-2475-4854-b426-d55aed0fddb3.json b/change/react-native-windows-b55776cc-2475-4854-b426-d55aed0fddb3.json new file mode 100644 index 00000000000..60c0e65912b --- /dev/null +++ b/change/react-native-windows-b55776cc-2475-4854-b426-d55aed0fddb3.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Raise a UIA TextSelectionChanged event when the TextInput caret/selection moves, so Narrator and braille displays announce character/word/line navigation during keyboard caret movement", + "packageName": "react-native-windows", + "email": "clintc@microsoft.com", + "dependentChangeType": "patch" +} \ No newline at end of file diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp index d78ab76afab..2d70d56a184 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp @@ -1457,6 +1457,17 @@ void WindowsTextInputComponentView::OnSelectionChanged(LONG start, LONG end) noe onSelectionChangeArgs.selection.end = end; emitter->onSelectionChange(onSelectionChangeArgs); } + + // Notify UI Automation clients (e.g. Narrator and braille displays) that the caret or + // selection moved, so they re-read the current character/word/line during keyboard + // navigation. Without this, arrowing through the text is silent for screen readers. + // Mirrors the focus- and value-changed raises elsewhere in the Composition layer. + if (UiaClientsAreListening()) { + auto spProviderSimple = EnsureUiaProvider().try_as(); + if (spProviderSimple != nullptr) { + UiaRaiseAutomationEvent(spProviderSimple.get(), UIA_Text_TextSelectionChangedEventId); + } + } } std::string WindowsTextInputComponentView::GetTextFromRichEdit() const noexcept {