Repository: nvaccess/nvda

Issue:
Microsoft Word with UIA spelling errors not announced when moving with arrow keys
### Steps to reproduce:
1. Start Microsoft Word in version for which UIA is automatically enabled.
2. type any word which isn't in Word dictionary, and for which Word is unable to perform correction automatically.
3. reread the line with arrow keys.
### Actual behavior:
The typed text is announced.
### Expected behavior:
The spelling error should be announced before the  misspelled word
### System configuration
#### NVDA installed/portable/running from source:
Installed
#### NVDA version:
alpha-16557,318aaa5b

#### Windows version:
Windows 10 version 1511
#### Name and version of other software in use when reproducing the issue:
Microsoft® Word  Office 365 MSO (16.0.11231.20022) (32-bit) 
#### Other information about your system:
I understand, that the version of Windows 10 in use is quite old, and that it might be causing the problem, but if it is really the cause (I am unable to verify this don't have access to more recent builds of Win 10) we have to either allow disabling UIA support, or enable it only for certain versions of Windows.
### Other questions
#### Does the issue still occur after restarting your PC?
Yes
#### Have you tried any other versions of NVDA?
The version which was still using COM to access MS Word worked correctly.


Discussion:
cc @michaelDCurran 
Just for your information: It works properly in Windows 10 1803 Build 17134 with this Alpha. Make sure that in MS Word options under "proofing", following is enabled:
1. Check spelling as you type
2. Check gramar while spelling.
The spelling erors are detected as such. I can navigate to them using f7, can move to them in browse mode with letter W and can list them in the elements list.
@Adriani90 What is your Word version by the way?
this is Microsoft® Word for Office 365 MSO (16.0.11126.20234) 32-Bit.

 

Von: Łukasz Golonka <notifications@github.com> 
Gesendet: Sonntag, 20. Januar 2019 21:37
An: nvaccess/nvda <nvda@noreply.github.com>
Cc: Adriani90 <adriani.botez@googlemail.com>; Mention <mention@noreply.github.com>
Betreff: Re: [nvaccess/nvda] Microsoft Word with UIA spelling errors not announced when moving with arrow keys (#9176)

 

@Adriani90 <https://github.com/Adriani90>  What is your Word version by the way?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/9176#issuecomment-455900153> , or mute the thread <https://github.com/notifications/unsubscribe-auth/Aaon8cEAGm339iGoCrOOogT4AcYxs-m2ks5vFNN9gaJpZM4aJ0Ls> .  <https://github.com/notifications/beacon/Aaon8S-Kpren_ICclA-PMN0QMHDcUYZbks5vFNN9gaJpZM4aJ0Ls.gif> 


I've tested it on Windows 10 1809, and it is working there, so old version of Win 10 is definitely cause here.

Resolving patch:
diff --git a/source/NVDAObjects/UIA/__init__.py b/source/NVDAObjects/UIA/__init__.py
--- a/source/NVDAObjects/UIA/__init__.py
+++ b/source/NVDAObjects/UIA/__init__.py
@@ -134,7 +134,7 @@ def _getFormatFieldAtRange(self,textRange,formatConfig,ignoreMixedValues=False):
 		formatField=textInfos.FormatField()
 		if not isinstance(textRange,UIAHandler.IUIAutomationTextRange):
 			raise ValueError("%s is not a text range"%textRange)
-		fetchAnnotationTypes=False
+		fetchAnnotationTypes=formatConfig["reportSpellingErrors"] or formatConfig["reportComments"] or formatConfig["reportRevisions"]
 		try:
 			textRange=textRange.QueryInterface(UIAHandler.IUIAutomationTextRange3)
 		except (COMError,AttributeError):
@@ -161,8 +161,7 @@ def _getFormatFieldAtRange(self,textRange,formatConfig,ignoreMixedValues=False):
 				IDs.add(UIAHandler.UIA_StyleNameAttributeId)
 			if formatConfig["reportHeadings"]:
 				IDs.add(UIAHandler.UIA_StyleIdAttributeId)
-			if formatConfig["reportSpellingErrors"] or formatConfig["reportComments"] or formatConfig["reportRevisions"]:
-				fetchAnnotationTypes=True
+			if fetchAnnotationTypes:
 				IDs.add(UIAHandler.UIA_AnnotationTypesAttributeId)
 			IDs.add(UIAHandler.UIA_CultureAttributeId)
 			fetcher=BulkUIATextRangeAttributeValueFetcher(textRange,IDs)


Test patch: