Skip to content

Commit be88fc4

Browse files
committed
Firefox and IE both incorrectly fire focus events themselves after a plugin may already have fired a focus event, which overrides the focus event fired by the plugin. This meant that the user had to press tab to interact with the plugin and even that mightn't work in some cases. Therefore, ignore these incorrect focus events from the browser.
Fixes #775.
1 parent 8fb89a9 commit be88fc4

4 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎source/NVDAObjects/IAccessible/MSHTML.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,3 +697,11 @@ def _get_firstChild(self):
697697
if not window or window == self.windowHandle:
698698
return super(Object, self).firstChild
699699
return Window(windowHandle=window)
700+
701+
class PluginWindow(IAccessible):
702+
"""A window for a plugin.
703+
"""
704+
705+
# MSHTML fires focus on this window after the plugin may already have fired a focus event.
706+
# We don't want this to override the focus event fired by the plugin.
707+
shouldAllowIAccessibleFocusEvent = False

‎source/NVDAObjects/IAccessible/__init__.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ def findOverlayClasses(self,clsList):
395395
from .msOffice import BrokenMsoCommandBar
396396
if BrokenMsoCommandBar.appliesTo(self):
397397
clsList.append(BrokenMsoCommandBar)
398+
elif windowClassName == "Internet Explorer_Server" and role == oleacc.ROLE_SYSTEM_WINDOW and self.event_objectID > 0:
399+
from .MSHTML import PluginWindow
400+
clsList.append(PluginWindow)
398401

399402
#Support for Windowless richEdit
400403
pIidITextServices=ctypes.cast(ctypes.windll.msftedit.IID_ITextServices,ctypes.POINTER(GUID))
@@ -1446,6 +1449,8 @@ def _get_lastChild(self):
14461449
("MozillaWindowClass",oleacc.ROLE_SYSTEM_DOCUMENT):"mozilla.Document",
14471450
("MozillaUIWindowClass",oleacc.ROLE_SYSTEM_TABLE):"mozilla.Table",
14481451
("MozillaUIWindowClass",oleacc.ROLE_SYSTEM_OUTLINE):"mozilla.Tree",
1452+
("MozillaContentWindowClass",IAccessibleHandler.IA2_ROLE_EMBEDDED_OBJECT):"mozilla.EmbeddedObject",
1453+
("MozillaContentWindowClass","embed"):"mozilla.EmbeddedObject",
14491454
("ConsoleWindowClass",oleacc.ROLE_SYSTEM_WINDOW):"ConsoleWindowClass",
14501455
(None,oleacc.ROLE_SYSTEM_LIST):"List",
14511456
(None,oleacc.ROLE_SYSTEM_COMBOBOX):"ComboBox",

‎source/NVDAObjects/IAccessible/mozilla.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import IAccessibleHandler
88
import oleacc
9+
import winUser
910
import eventHandler
1011
import controlTypes
1112
from . import IAccessible
@@ -94,3 +95,13 @@ class Table(Mozilla):
9495

9596
class Tree(Mozilla):
9697
shouldAllowIAccessibleFocusEvent=True
98+
99+
class EmbeddedObject(Mozilla):
100+
101+
def _get_shouldAllowIAccessibleFocusEvent(self):
102+
focusWindow = winUser.getGUIThreadInfo(self.windowThreadID).hwndFocus
103+
if self.windowHandle != focusWindow:
104+
# This window doesn't have the focus, which means the embedded object's window probably already has the focus.
105+
# We don't want to override the focus event fired by the embedded object.
106+
return False
107+
return super(EmbeddedObject, self).shouldAllowIAccessibleFocusEvent

‎user_docs/en/changes.t2t‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
- It is again possible to review the contents of cells in MS Excel with the review cursor.
5353
- NVDA can again read by line in certain problematic textArea fields in Internet Explorer 8. (#467)
5454
- Windows Live Messenger 2009 no longer exits immediately after it is started while NVDA is running. (#677)
55+
- In web browsers, It is no longer necessary to press tab to interact with an embedded object (such as Flash content) after pressing enter on the embedded object or returning from another application. (#775)
5556

5657

5758
= 2010.1 =

0 commit comments

Comments
 (0)