Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Automation in Windows Console and Windows Terminal: block SV2M2 notification events for now and preserve accessibility after UIA class name change #13261

Merged
merged 4 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,12 @@ def findOverlayClasses(self,clsList):
if self.windowClassName == "ConsoleWindowClass":
from . import winConsoleUIA
winConsoleUIA.findExtraOverlayClasses(self, clsList)
elif UIAClassName == "TermControl":
elif UIAClassName in ("TermControl", "TermControl2"):
# microsoft/terminal#12358: Eventually, TermControl2 should have
# a separate overlay class that is not a descendant of LiveText.
# TermControl2 sends inserted text using UIA notification events,
# so it is no longer necessary to diff the object as with all
# previous terminal implementations.
from . import winConsoleUIA
clsList.append(winConsoleUIA.WinTerminalUIA)

Expand Down
22 changes: 21 additions & 1 deletion source/NVDAObjects/UIA/winConsoleUIA.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,17 @@ def detectPossibleSelectionChange(self):
"probably due to a switch to/from the alt buffer."
), exc_info=True)

def event_UIA_notification(self, **kwargs):
"""
In Windows Sun Valley 2 (SV2 M2), UIA notification events will be sent
to announce new text. Block these for now to avoid double-reporting of
text changes.
@note: In the longer term, NVDA should leverage these events in place
of the current LiveText strategy, as performance will likely be
significantly improved and #11002 can be completely mitigated.
"""
log.debugWarning(f"Notification event blocked to avoid double-report: {kwargs}")


def findExtraOverlayClasses(obj, clsList):
if obj.UIAElement.cachedAutomationId == "Text Area":
Expand All @@ -409,4 +420,13 @@ def findExtraOverlayClasses(obj, clsList):


class WinTerminalUIA(EnhancedTermTypedCharSupport):
pass
def event_UIA_notification(self, **kwargs):
"""
In an upcoming terminal release, UIA notification events will be sent
to announce new text. Block these for now to avoid double-reporting of
text changes.
@note: In the longer term, NVDA should leverage these events in place
of the current LiveText strategy, as performance will likely be
significantly improved and #11002 can be completely mitigated.
"""
log.debugWarning(f"Notification event blocked to avoid double-report: {kwargs}")