Skip to content

Commit

Permalink
In Spotify, focus no longer frequently lands on "unknown" objects. Al…
Browse files Browse the repository at this point in the history
…so, focus is now restored correctly when returning to Spotify from another application.

Fixes #5439.
  • Loading branch information
jcsteh committed Dec 3, 2015
1 parent be297e6 commit c36d560
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions source/appModules/spotify.py
@@ -0,0 +1,31 @@
#appModules/spotify.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2013 NV Access Limited

"""App module for Spotify
"""

import appModuleHandler
import controlTypes
from NVDAObjects.IAccessible import IAccessible
import eventHandler

class AppModule(appModuleHandler.AppModule):

def event_NVDAObject_init(self, obj):
if obj.windowClassName == "Chrome_RenderWidgetHostHWND" and isinstance(obj, IAccessible) and obj.IAccessibleChildID < 0 and obj.role == controlTypes.ROLE_UNKNOWN:
# #5439: Focus seems to hit Chromium objects that die before we can fetch them.
obj.shouldAllowIAccessibleFocusEvent = False

def event_gainFocus(self, obj, nextHandler):
if not eventHandler.isPendingEvents("gainFocus") and obj.windowClassName == "Chrome_WidgetWin_0" and obj.role == controlTypes.ROLE_WINDOW:
# Spotify doesn't fire focus on the correct object when it gets the foreground.
try:
focus = obj.activeChild.activeChild
except AttributeError:
focus = None
if focus:
return eventHandler.executeEvent("gainFocus", focus)
return nextHandler()
2 changes: 2 additions & 0 deletions user_docs/en/changes.t2t
Expand Up @@ -12,6 +12,8 @@
== Bug Fixes ==
- In iTunes 12, browse mode now updates correctly when a new page loads in the iTunes Store. (#5191)
- In Internet Explorer and other MSHTML controls, moving to specific heading levels with single letter navigation now behaves as expected when the level of a heading is overridden for accessibility purposes (specifically, when aria-level overrides the level of an h tag). (#5434)
- In Spotify, focus no longer frequently lands on "unknown" objects. (#5439)
- Focus is now restored correctly when returning to Spotify from another application. (#5439)


= 2015.4 =
Expand Down

0 comments on commit c36d560

Please sign in to comment.