Skip to content

Commit

Permalink
Bug Report nvaccess#12331
Browse files Browse the repository at this point in the history
NVDA does not announce the names of the menus when walking with left and right arrows in iTunes. This can potentially be fixed by adding a class which helps accesses the text inside of an iTunes menu box. The function added below will attempt to provide that functionality. Further additions are above which add an object of this class to the clsList in chooseNVDAObjectOverlayClasses. A comment was not made on the bug report due to the issue unaffecting the user experience in any way and tight scheduling. Considering I have not contributed to NVDA before, this implementation may be going off the rails. However, I think I have provided a decent foundation in solving this issue.
  • Loading branch information
jtflan1 authored Apr 26, 2021
1 parent d9afe35 commit 815a4b5
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions source/appModules/itunes.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
clsList.insert(0, WebKitDocument)
elif windowClassName=="iTunes" and obj.IAccessibleRole==oleacc.ROLE_SYSTEM_CLIENT:
clsList.insert(0, TopLevelClient)


############## BEGINNING ##############
# #12331: See documentation at the end of this file for more details.
# Menu text is not announced to the user, class created below should
# allow functionality for this.
# not entirely sure if this is properly checking whether a windowClassName resides as being apart of a menu slider
elif windowClassName in ('iTunesList') and role in (controlTypes.ROLE_LISTITEM,controlTypes.ROLE_TREEVIEWITEM):
# inserting title into clsList of the correct menu heading
clsList.insert(0,AccessMenuTitles)
################# END #################

class ITunesItem(NVDAObjects.IAccessible.IAccessible):
"""Retreaves position information encoded in the accDescription"""
Expand Down Expand Up @@ -110,3 +121,34 @@ def _isEqual(self, other):
if self.IAccessibleIdentity == other.IAccessibleIdentity:
return True
return super(TopLevelClient, self)._isEqual(other)

############## BEGINNING ##############
# #12331: NVDA does not announce the names of the menus when walking with left and right
# arrows in iTunes. This can potentially be fixed by adding a class which helps accesses the text
# inside of an iTunes menu box. The function added below will attempt to provide that functionality.
# Further additions are above which add an object of this class to the clsList in chooseNVDAObjectOverlayClasses.
# A comment was not made on the bug report due to the issue unaffecting the user experience in any way and tight scheduling.
# Considering I have not contributed to NVDA before, this implementation may be going off the rails. However, I think I have
# provided a decent foundation in solving this issue.
class AccessMenuTitles(NVDAObjects.IAccessible.IAccessible):
# function that attempts to grab title of focused object
def _get_name(self):
try:
title=self.title.text
except comtypes.COMError:
title=None
# Translators: the label for a menu in iTunes.
name=_("Menu Label")
if title:
name+=" (%s)"%title
return name

# copied from iTunesItem class
# ensures the title allows for an interface event
def _get_shouldAllowIAccessibleFocusEvent(self):
# These items can fire spurious focus events; e.g. when tabbing out of the Music list.
# The list reports that it's focused even when it isn't.
# Thankfully, the list items don't.
return self.hasFocus

################# END #################

0 comments on commit 815a4b5

Please sign in to comment.