From 05a30bd936b67348675cd838df4df3551ea5ffed Mon Sep 17 00:00:00 2001 From: Clint Covington <7833316+ClintC@users.noreply.github.com> Date: Thu, 18 Jun 2026 19:25:40 -0700 Subject: [PATCH] fix(textinput): announce caret navigation to screen readers The Composition WindowsTextInput never raised a UI Automation TextSelectionChanged event when the caret or selection moved, so Narrator and braille displays stayed silent while arrowing through text. Focus was announced on entering the field, but per-character, word, and line caret navigation produced no event for assistive technology to re-read. Raise UIA_Text_TextSelectionChangedEventId from OnSelectionChanged, guarded by UiaClientsAreListening(), mirroring the existing focus-changed and value-changed raises elsewhere in the Composition layer. Co-Authored-By: Claude Opus 4.8 (1M context) --- ...-windows-b55776cc-2475-4854-b426-d55aed0fddb3.json | 7 +++++++ .../TextInput/WindowsTextInputComponentView.cpp | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 change/react-native-windows-b55776cc-2475-4854-b426-d55aed0fddb3.json 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 {