From ec3d033c6eb574439bca4b8a1836a8e5d6a293f9 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Sun, 1 Sep 2024 19:54:40 -0600 Subject: [PATCH] Word 365: do not announce font attribute toggle messages if raised from UIA notification event (#10990) Fixes #10950 Summary of the issue: In recent Word 365 releases, NVDA will announce font attribute toggle message up to two times - a message defined by NVDA ,and a second time thanks to UIA notification event. Description of how this pull request fixes the issue: Builds on an earlier work on Word 365 UIA notification event suppression (#10851): Adds a dedicated list in UIA.WordDocument class listing activity ID's NVDA should ignore. Adds AccSN1, the activity Id for font attribute toggle messages. --- source/NVDAObjects/UIA/wordDocument.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/NVDAObjects/UIA/wordDocument.py b/source/NVDAObjects/UIA/wordDocument.py index a1836880f85..41ec251d524 100644 --- a/source/NVDAObjects/UIA/wordDocument.py +++ b/source/NVDAObjects/UIA/wordDocument.py @@ -607,10 +607,15 @@ def event_textChange(self): if not eventHandler.isPendingEvents("caret", self): eventHandler.queueEvent("caret", self) + suppressedActivityIds = [ + "AccSN1", # #10950: font attributes + "AccSN2", # #10851: delete activity ID + ] + 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 + # In recent Word 365 releases, UIA notification will cause NVDA to announce edit functions + # such as "delete back word" when Control+Backspace is pressed or font attributes are toggled. + if activityId in self.suppressedActivityIds: return super(WordDocument, self).event_UIA_notification(**kwargs)