Repository: nvaccess/nvda

Issue:
Control+backspace reports "DeleteBackWord" in Word 365
<!--
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/wiki/Github-issue-template-explanation-and-examples
-->

### Steps to reproduce:

1. Open Word 365 to a blank document.
2. Type a word
3. press CONTROL+BACKSPACE.

### Actual behavior:

NVDA reports "DeleteBackWord".

### Expected behavior:

NVDA should report the word deleted.

### System configuration
#### NVDA installed/portable/running from source:
#### NVDA version:

Installed 2019.3.1
Portable 2019.2
Portable alpha-19755,6d40a54e

#### Windows version:
Windows 10 Build 1903 Version 18362.388

#### Name and version of other software in use when reproducing the issue:

Office 365 Version: 
16.0.12430.20286 

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your computer?

#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Yes, as above.

#### If addons are disabled, is your problem still occuring?
Yes.

#### Did you try to run the COM registry fixing tool in NVDA menu / tools?

No change.  One user noted that at the same time as this started, CONTROL+X, CONTROL+C and CONTROL+V now report "Cut", "Copy" and "Paste" in Word.  Note that this is WITHOUT any add-ons which otherwise provide that functionality and only seems to do this in Word.  Note that this behaviour is the same whether the Use UIA in Word option (in NVDA's Advanced options) is enabled or not.

Log snipped below:

IO - inputCore.InputManager.executeGesture (15:12:13.467) - winInputHook (14180):
Input: kb(desktop):control+backspace
DEBUGWARNING - Python warning (15:12:13.495) - MainThread (18304):
C:\Program Files (x86)\NVDA\library.zip\keyboardHandler.py:538: DeprecationWarning: Yield() is deprecated
DEBUGWARNING - Python warning (15:12:13.495) - MainThread (18304):
C:\Program Files (x86)\NVDA\library.zip\api.py:287: DeprecationWarning: Yield() is deprecated
DEBUG - IAccessibleHandler.accessibleObjectFromEvent (15:12:13.501) - MainThread (18304):
oleacc.AccessibleObjectFromEvent with window 199388, objectID 43 and childID 0: [WinError -2147467259] Unspecified error
DEBUG - IAccessibleHandler.accessibleObjectFromEvent (15:12:13.502) - MainThread (18304):
oleacc.AccessibleObjectFromEvent with window 199388, objectID 44 and childID 0: [WinError -2147467259] Unspecified error
DEBUG - editableText.EditableText._hasCaretMoved (15:12:13.511) - MainThread (18304):
Caret move detected using bookmarks. Elapsed: 0 ms
IO - speech.speak (15:12:13.511) - MainThread (18304):
Speaking [LangChangeCommand ('en_AU'), 'fox']
DEBUG - synthDrivers.oneCore.SynthDriver._processQueue (15:12:13.524) - MainThread (18304):
Begin processing speech
DEBUG - synthDrivers.oneCore.SynthDriver.cancel (15:12:13.528) - MainThread (18304):
Cancelling
IO - speech.speak (15:12:13.530) - MainThread (18304):
Speaking [LangChangeCommand ('en_AU'), 'DeleteBackWord'] 




Discussion:
cc: @michaelDCurran 

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
@@ -1,7 +1,7 @@
-#A part of NonVisual Desktop Access (NVDA)
-#This file is covered by the GNU General Public License.
-#See the file COPYING for more details.
-#Copyright (C) 2016 NV Access Limited
+# A part of NonVisual Desktop Access (NVDA)
+# This file is covered by the GNU General Public License.
+# See the file COPYING for more details.
+# Copyright (C) 2016-2020 NV Access Limited, Joseph Lee
 
 from comtypes import COMError
 from collections import defaultdict
@@ -320,6 +320,13 @@ 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_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.
+		if activityId == "AccSN2":  # Delete activity ID
+			return
+		super(WordDocument, self).event_UIA_notification(**kwargs)
+
 	def script_reportCurrentComment(self,gesture):
 		caretInfo=self.makeTextInfo(textInfos.POSITION_CARET)
 		caretInfo.expand(textInfos.UNIT_CHARACTER)


Test patch: