Repository: nvaccess/nvda

Issue:
Typing in Word 365 with UIA Enabled Does Not Show Output on Braille Display Until I press Right Arrow
<!-- Please read the text in this edit field before filling it in.
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/blob/master/devDocs/githubIssueTemplateExplanationAndExamples.md
Please also note that the NVDA project has a Citizen and Contributor Code of Conduct which can be found at https://github.com/nvaccess/nvda/blob/master/CODE_OF_CONDUCT.md. NV Access expects that all contributors and other community members read and abide by the rules set out in this document while participating or contributing to this project. This includes creating or commenting on issues and pull requests. 

Each of the questions and sections below start with multiple hash symbols (#). Place your answers and information on the blank line below each question.
-->

### Steps to reproduce:
With braille display connected:
1. Go to advanced NVDA settings and enable use UI automation for MS Word.
2. Open Word 365.
3. Type text. Notice that the text I'm entering is not showing up on the braille display until I press right arrow.

### Actual behavior:
When I type text in Word 365 with a braille display connected and UI automation enabled, the text I've entered is not showing up on the braille display until I press right arrow. When I disable UI automation support, the issue goes away but everything becomes more sluggish.

### Expected behavior:
When typing text in Word 365, the words I'm typing should be coming up on the braille display. I should not have to press right arrow just to see what I've typed on the braille display.

### System configuration
#### NVDA installed/portable/running from source:
Installed.

#### NVDA version:
2021.3 Beta 1

#### Windows version:
Windows 10 21H1 x64 build 19043.1288

#### Name and version of other software in use when reproducing the issue:
MS Word 365 version 2109

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your computer?
yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.
no

#### If NVDA add-ons are disabled, is your problem still occurring?
yes

#### Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?
yes


Discussion:
This is a duplicate of #12970. We disabled UIA in Word by default for this release because there still issues to resolve, I don't think we will try to fix it for the release (unless it is a small low risk change).

Resolving patch:
diff --git a/source/NVDAObjects/UIA/wordDocument.py b/source/NVDAObjects/UIA/wordDocument.py
--- a/source/NVDAObjects/UIA/wordDocument.py
+++ b/source/NVDAObjects/UIA/wordDocument.py
@@ -412,6 +412,11 @@ class WordDocument(UIADocumentWithTableNavigation,WordDocumentNode,WordDocumentB
 	# Microsoft Word duplicates the full title of the document on this control, which is redundant as it appears in the title of the app itself.
 	name=u""
 
+	def event_textChange(self):
+		# Ensure Braille is updated when text changes,
+		# As Microsoft Word does not fire caret events when typing text, even though the caret does move.
+		braille.handler.handleCaretMove(self)
+
 	def event_UIA_notification(self, activityId=None, **kwargs):
 		# #10851: in recent Word 365 releases, UIA notification will cause NVDA to announce edit functions
 		# such as "delete back word" when Control+Backspace is pressed.


Test patch: