Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion source/_UIAHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
goodUIAWindowClassNames=[
# A WDAG (Windows Defender Application Guard) Window is always native UIA, even if it doesn't report as such.
'RAIL_WINDOW',
"EXCEL6",
]

badUIAWindowClassNames=[
Expand Down
26 changes: 25 additions & 1 deletion source/appModules/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html

import time
import config
import eventHandler
import api
import UIAHandler
Expand All @@ -15,6 +16,8 @@
from NVDAObjects.window.edit import UnidentifiedEdit
from NVDAObjects.window import Window
from NVDAObjects.window.excel import ExcelCell
from NVDAObjects.IAccessible import IAccessible


class Excel6(Window):
"""
Expand Down Expand Up @@ -43,6 +46,17 @@ def _get_focusRedirect(self):
self.focusRedirect=obj
return obj


class Excel6_WhenUIAEnabled(IAccessible):
"""
#12303: When accessing Microsoft Excel via UI Automation
MSAA focus events on the old formula edit window should be completely ignored.
UI Automation will fire its own ones.
"""

shouldAllowIAccessibleFocusEvent = False


class AppModule(appModuleHandler.AppModule):

def chooseNVDAObjectOverlayClasses(self, obj, clsList):
Expand All @@ -55,4 +69,14 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
pass
clsList.insert(0, DisplayModelEditableText)
if windowClass=="EXCEL6":
clsList.insert(0,Excel6)
if config.conf["UIA"]["useInMSExcelWhenAvailable"]:
# #12303: When accessing Microsoft Excel via UI Automation
# MSAA focus events on the old formula edit window should be completely ignored.
# UI Automation will fire its own ones.
clsList.insert(0, Excel6_WhenUIAEnabled)
else:
# #12303: The old Formula Edit window in recent versions of Excel
# may not be accessible with display models as GDI is no longer used.
# However, UI Automation does expose an accessible edit control within the active cell,
# So use a class that will redirect focus to that.
clsList.insert(0, Excel6)