diff --git a/source/NVDAObjects/UIA/VisualStudio.py b/source/NVDAObjects/UIA/VisualStudio.py index 380c17cf27a..edd3ec03b8b 100644 --- a/source/NVDAObjects/UIA/VisualStudio.py +++ b/source/NVDAObjects/UIA/VisualStudio.py @@ -7,10 +7,11 @@ available in Visual Studio and SQL Server Management Studio. """ -from . import UIA +from . import UIA, ToolTip import speech import braille import api +import time class IntelliSenseItem(UIA): @@ -53,6 +54,34 @@ class IntelliSenseLiveRegion(UIA): } +class CompletionToolTip(ToolTip): + """ A tool tip for which duplicate open events can be fired. + """ + + #: Keeps track of the last ToolTipOpened event (text, time) + _lastToolTipOpenedInfo = (None, None) + #: The duplicate tooltip events will be dropped within this time window + _preventDuplicateToolTipSeconds = 0.2 + + def event_UIA_toolTipOpened(self): + oldText, oldTime = self._lastToolTipOpenedInfo + newText = self.name + newTime = time.time() + self.__class__._lastToolTipOpenedInfo = (newText, newTime) + withinPossibleDupToolTipTimeWindow = ( + oldTime is not None + and (newTime - oldTime) < self._preventDuplicateToolTipSeconds + ) + if newText == oldText and withinPossibleDupToolTipTimeWindow: + # Tool-tip event suspected to be a duplicate, drop the event. + # - Users attempting to rapidly re-announce tool-tips may + # have the announcement erroneously suppressed + # - Users on slower systems (or systems under load) may still + # receive duplicate announcements + return + super().event_UIA_toolTipOpened() + + def findExtraOverlayClasses(obj, clsList): if obj.UIAAutomationId in _INTELLISENSE_LIST_AUTOMATION_IDS: clsList.insert(0, IntelliSenseList) @@ -64,3 +93,5 @@ def findExtraOverlayClasses(obj, clsList): and isinstance(obj.previous.previous, IntelliSenseList) ): clsList.insert(0, IntelliSenseLiveRegion) + elif obj.UIAAutomationId == "completion tooltip": + clsList.insert(0, CompletionToolTip) diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index 7ce7551e2b5..254235c6f6c 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -57,6 +57,7 @@ What's New in NVDA - In Microsoft Teams builds with version numbers like 1.3.00.28xxx, NVDA no longer fails reading messages in chats or Teams channels due to an incorrectly focused menu. (#11821) - Text marked both as being a spelling and grammar error at the same time in Google Chrome will be appropriately announced as both a spelling and grammar error by NVDA. (#11787) - When using Outlook (French locale), the shortcut for 'Reply all' (control+shift+R) works again. (#11196) +- In Visual Studio, IntelliSense tool tips that provide additional details about the currently selected IntelliSense item are now only reported once. (#11611) == Changes for Developers ==