Skip to content

Fix mouse exploration on Windows Terminal - #20450

Merged
seanbudd merged 6 commits into
nvaccess:masterfrom
DataTriny:fix-terminal-mouse-tracking
Jul 31, 2026
Merged

Fix mouse exploration on Windows Terminal#20450
seanbudd merged 6 commits into
nvaccess:masterfrom
DataTriny:fix-terminal-mouse-tracking

Conversation

@DataTriny

Copy link
Copy Markdown
Contributor

Link to issue number:

Closes #20448

Summary of the issue:

Mouse exploration doesn't work on Windows Terminal due to the window hierarchy.

Description of user facing changes:

Hovering the mouse over a Windows Terminal window now reports the text (the whole line by default). Controls of the tab bar and scrollbars also work.

Description of developer facing changes:

Adds a dedicated app module for this application as well as a new TextRange class to make sure hovering over a window doesn't try to report the entire text buffer.

Description of development approach:

Testing strategy:

Opened a Windows Terminal window and moved the mouse around. Also tried with an instance with a large buffer.

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@DataTriny
DataTriny requested a review from a team as a code owner July 5, 2026 16:57
@DataTriny
DataTriny requested a review from seanbudd July 5, 2026 16:57
@josephsl

josephsl commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Hi,

Can someone test this on a touchscreen computer to make sure the fix also applies with that input modality?

Thanks.

@hwf1324

hwf1324 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

I didn't want to test by building a self-signed launcher and installing it, so I used the following app module code for testing:

# scratchpad\appModules\windowsterminal.py

"""Windows Terminal appModule"""

import appModuleHandler
import winUser


class AppModule(appModuleHandler.AppModule):

	def isGoodUIAWindow(self, hwnd) -> bool:
		if winUser.getClassName(hwnd) == "CASCADIA_HOSTING_WINDOW_CLASS":
			return True
		return super().isGoodUIAWindow(hwnd)

The conclusion is that touch input can correctly read the text on the terminal. Furthermore, strangely enough, unlike the mouse, touch input can read the text line by line.

Additionally, the following COM error is raised when touching the tab title text control:

error executing script: <bound method GlobalCommands.script_touch_explore of <globalCommands.GlobalCommands object at 0x000001C0D1461A90>> with gesture '移动'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 300, in executeScript
  File "globalCommands.pyc", line 4722, in script_touch_explore
  File "screenExplorer.pyc", line 81, in moveTo
  File "NVDAObjects\UIA\__init__.pyc", line 1113, in compareEndPoints
_ctypes.COMError: (-2147024809, '参数错误。', (None, None, None, 0, None))

@hwf1324

hwf1324 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

The error above may be related to WinUI 3; additionally, it is impossible to navigate to the minimize, maximize, and close buttons via touch exploration.

@DataTriny

Copy link
Copy Markdown
Contributor Author

I don't get any exception when hovering over a tab title with the mouse. The name of the Close/Maximize/Minimize buttons is not reported with or without this patch, but the Narrator also fails here so maybe not something we can fix on the client side.

Comment thread source/NVDAObjects/UIA/winConsoleUIA.py
Comment thread source/appModules/windowsterminal.py Outdated
Comment thread source/NVDAObjects/UIA/winConsoleUIA.py Outdated
@seanbudd
seanbudd marked this pull request as draft July 8, 2026 05:26
@carlos-zamora

Copy link
Copy Markdown

The error above may be related to WinUI 3; additionally, it is impossible to navigate to the minimize, maximize, and close buttons via touch exploration.

FYI: Windows Terminal is built using WinUI 2 and XAML Islands, not WinUI 3.

I forget why exactly we replaced the minimize, maximize, and close buttons, but the code for that in the Terminal repo is here: https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/MinMaxCloseControl.xaml

I'm noticing that they are marked as AutomationProperties.AccessibilityView="Raw" though. Could that be related/relevant here?

@seanbudd

Copy link
Copy Markdown
Member

Is this still being worked on?

@DataTriny
DataTriny force-pushed the fix-terminal-mouse-tracking branch from dbcb75e to 8ad301b Compare July 28, 2026 08:43
@DataTriny
DataTriny marked this pull request as ready for review July 28, 2026 20:11
@DataTriny
DataTriny requested a review from seanbudd July 28, 2026 20:11
Comment thread source/NVDAObjects/UIA/winConsoleUIA.py Outdated
Comment thread user_docs/en/changes.md
@seanbudd
seanbudd marked this pull request as draft July 29, 2026 00:31
Comment thread source/appModules/OpenConsole.py Outdated
@DataTriny
DataTriny marked this pull request as ready for review July 30, 2026 08:02
@DataTriny
DataTriny requested a review from seanbudd July 30, 2026 08:02

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DataTriny

@seanbudd
seanbudd merged commit 8af4d0c into nvaccess:master Jul 31, 2026
41 of 46 checks passed
@github-actions github-actions Bot added this to the 2026.3 milestone Jul 31, 2026
@DataTriny
DataTriny deleted the fix-terminal-mouse-tracking branch July 31, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mouse exploration reports nothing over Windows Terminal

6 participants