Skip to content

Commit

Permalink
Fix spurious reporting of aria-hidden focus ancestors in Firefox. (nv…
Browse files Browse the repository at this point in the history
…access#7357)

When presentationType is unavailable, isPresentableFocusAncestor should be False, just as it is for layout. Previously, it was True.
Unfortunately, NVDA's message dialogs are sometimes briefly treated as unavailable when they get focus. We still want them to be reported. Work around this in the app module for NVDA itself.
  • Loading branch information
jcsteh authored Aug 1, 2017
1 parent 0bc88dc commit b90069a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/NVDAObjects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ def _get_isPresentableFocusAncestor(self):
@return: C{True} if it should be presented in the focus ancestry, C{False} if not.
@rtype: bool
"""
if self.presentationType == self.presType_layout:
if self.presentationType in (self.presType_layout, self.presType_unavailable):
return False
if self.role in (controlTypes.ROLE_TREEVIEWITEM, controlTypes.ROLE_LISTITEM, controlTypes.ROLE_PROGRESSBAR, controlTypes.ROLE_EDITABLETEXT):
return False
Expand Down
20 changes: 19 additions & 1 deletion source/appModules/nvda.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#appModules/nvda.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2008-2011 NV Access Inc
#Copyright (C) 2008-2017 NV Access Limited
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

Expand All @@ -14,6 +14,20 @@

nvdaMenuIaIdentity = None

class NvdaDialog(IAccessible):
"""Fix to ensure NVDA message dialogs get reported when they pop up.
"""

def _get_presentationType(self):
presType = super(NvdaDialog, self).presentationType
# Sometimes, NVDA message dialogs briefly report the invisible state
# after they're focused.
# This causes them to be treated as unavailable and they are thus not reported.
# If this dialog is in the foreground, treat it as content.
if presType == self.presType_unavailable and self == api.getForegroundObject():
return self.presType_content
return presType

class AppModule(appModuleHandler.AppModule):

def isNvdaMenu(self, obj):
Expand Down Expand Up @@ -48,3 +62,7 @@ def event_foreground (self, obj, nextHandler):
if not gui.shouldConfigProfileTriggersBeSuspended():
config.conf.resumeProfileTriggers()
nextHandler()

def chooseNVDAObjectOverlayClasses(self, obj, clsList):
if obj.windowClassName == "#32770" and obj.role == controlTypes.ROLE_DIALOG:
clsList.insert(0, NvdaDialog)

0 comments on commit b90069a

Please sign in to comment.