Skip to content

Commit eb60e27

Browse files
authored
Merge 8f46285 into 51aacac
2 parents 51aacac + 8f46285 commit eb60e27

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

source/appModules/explorer.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@
1010

1111
from comtypes import COMError
1212
import time
13+
from typing import Callable
1314
import appModuleHandler
1415
import controlTypes
1516
import winUser
1617
import winVersion
1718
import api
1819
import speech
20+
import braille
1921
import eventHandler
2022
import mouseHandler
23+
from NVDAObjects import NVDAObject
2124
from NVDAObjects.IAccessible import IAccessible, List
2225
from NVDAObjects.UIA import UIA
2326
from NVDAObjects.behaviors import ToolTip
@@ -552,3 +555,23 @@ def event_UIA_window_windowOpen(self, obj, nextHandler):
552555
eventHandler.executeEvent("UIA_window_windowOpen", inputPanelWindow)
553556
return
554557
nextHandler()
558+
559+
def event_UIA_elementSelected(self, obj: NVDAObject, nextHandler: Callable[[], None]):
560+
# #14388: announce File Explorer tab switches (Windows 11 22H2 and later).
561+
if (
562+
obj.role == controlTypes.Role.TAB
563+
and controlTypes.State.SELECTED in obj.states
564+
and obj.parent.UIAAutomationId == "TabListView"
565+
# this is done because 2 selection events are sent for the same object, so to prevent double speaking.
566+
and not eventHandler.isPendingEvents(eventName="UIA_elementSelected")
567+
):
568+
speech.speakObject(obj, reason=controlTypes.OutputReason.FOCUS)
569+
braille.handler.message(
570+
braille.getPropertiesBraille(
571+
name=obj.name,
572+
role=obj.role,
573+
states=obj.states,
574+
positionInfo=obj.positionInfo
575+
)
576+
)
577+
nextHandler()

0 commit comments

Comments
 (0)