Skip to content

Commit 05a30bd

Browse files
ClintCclaude
andcommitted
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) <noreply@anthropic.com>
1 parent ebdfffb commit 05a30bd

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"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",
4+
"packageName": "react-native-windows",
5+
"email": "clintc@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,17 @@ void WindowsTextInputComponentView::OnSelectionChanged(LONG start, LONG end) noe
14571457
onSelectionChangeArgs.selection.end = end;
14581458
emitter->onSelectionChange(onSelectionChangeArgs);
14591459
}
1460+
1461+
// Notify UI Automation clients (e.g. Narrator and braille displays) that the caret or
1462+
// selection moved, so they re-read the current character/word/line during keyboard
1463+
// navigation. Without this, arrowing through the text is silent for screen readers.
1464+
// Mirrors the focus- and value-changed raises elsewhere in the Composition layer.
1465+
if (UiaClientsAreListening()) {
1466+
auto spProviderSimple = EnsureUiaProvider().try_as<IRawElementProviderSimple>();
1467+
if (spProviderSimple != nullptr) {
1468+
UiaRaiseAutomationEvent(spProviderSimple.get(), UIA_Text_TextSelectionChangedEventId);
1469+
}
1470+
}
14601471
}
14611472

14621473
std::string WindowsTextInputComponentView::GetTextFromRichEdit() const noexcept {

0 commit comments

Comments
 (0)