Skip to content

Commit ab0cee1

Browse files
authored
Merge a590965 into 054d7b2
2 parents 054d7b2 + a590965 commit ab0cee1

9 files changed

Lines changed: 55 additions & 7 deletions

File tree

source/aria.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import controlTypes
77

88
ariaRolesToNVDARoles={
9-
"description":controlTypes.ROLE_STATICTEXT,
10-
"search":controlTypes.ROLE_SECTION,
119
"alert":controlTypes.ROLE_ALERT,
1210
"alertdialog":controlTypes.ROLE_DIALOG,
1311
"article": controlTypes.ROLE_ARTICLE,
@@ -17,9 +15,11 @@
1715
"columnheader":controlTypes.ROLE_TABLECOLUMNHEADER,
1816
"combobox":controlTypes.ROLE_COMBOBOX,
1917
"definition":controlTypes.ROLE_LISTITEM,
18+
"description":controlTypes.ROLE_STATICTEXT,
2019
"dialog":controlTypes.ROLE_DIALOG,
2120
"directory":controlTypes.ROLE_LIST,
2221
"document":controlTypes.ROLE_DOCUMENT,
22+
"figure":controlTypes.ROLE_FIGURE,
2323
"form":controlTypes.ROLE_FORM,
2424
"grid":controlTypes.ROLE_TABLE,
2525
"gridcell":controlTypes.ROLE_TABLECELL,
@@ -42,6 +42,7 @@
4242
"row":controlTypes.ROLE_TABLEROW,
4343
"rowgroup":controlTypes.ROLE_GROUPING,
4444
"rowheader":controlTypes.ROLE_TABLEROWHEADER,
45+
"search":controlTypes.ROLE_SECTION,
4546
"separator":controlTypes.ROLE_SEPARATOR,
4647
"scrollbar":controlTypes.ROLE_SCROLLBAR,
4748
"slider":controlTypes.ROLE_SLIDER,

source/braille.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@
127127
# grouping.
128128
controlTypes.ROLE_GROUPING: _("grp"),
129129
# Translators: Displayed in braille for an object which is a
130+
# caption.
131+
controlTypes.ROLE_CAPTION: _("cap"),
132+
# Translators: Displayed in braille for an object which is a
130133
# embedded object.
131134
controlTypes.ROLE_EMBEDDEDOBJECT: _("embedded"),
132135
# Translators: Displayed in braille for an object which is a
@@ -173,6 +176,9 @@
173176
controlTypes.ROLE_LANDMARK: _("lmk"),
174177
# Translators: Displayed in braille for an object which is an article.
175178
controlTypes.ROLE_ARTICLE: _("art"),
179+
# Translators: Displayed in braille for an object which is a
180+
# figure.
181+
controlTypes.ROLE_FIGURE: _("fig"),
176182
}
177183

178184
positiveStateLabels = {

source/config/configSpec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
reportLists = boolean(default=true)
182182
reportHeadings = boolean(default=true)
183183
reportBlockQuotes = boolean(default=true)
184+
reportGroupings = boolean(default=true)
184185
reportLandmarks = boolean(default=true)
185186
reportArticles = boolean(default=false)
186187
reportFrames = boolean(default=true)

source/controlTypes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
ROLE_INSERTED_CONTENT=148
155155
ROLE_LANDMARK = 149
156156
ROLE_ARTICLE = 150
157+
ROLE_FIGURE = 151
157158

158159
STATE_UNAVAILABLE=0X1
159160
STATE_FOCUSED=0X2
@@ -498,6 +499,8 @@
498499
ROLE_LANDMARK: _("landmark"),
499500
# Translators: Identifies an article.
500501
ROLE_ARTICLE: _("article"),
502+
# Translators: Identifies a figure (commonly seen on some websites).
503+
ROLE_FIGURE: _("figure"),
501504
}
502505

503506
stateLabels={

source/globalCommands.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,22 @@ def script_toggleReportHeadings(self,gesture):
623623
script_toggleReportHeadings.__doc__=_("Toggles on and off the reporting of headings")
624624
script_toggleReportHeadings.category=SCRCAT_DOCUMENTFORMATTING
625625

626+
@script(
627+
# Translators: Input help mode message for toggle report groupings command.
628+
description=_("Toggles on and off the reporting of groupings"),
629+
category=SCRCAT_DOCUMENTFORMATTING
630+
)
631+
def script_toggleReportGroupings(self, gesture):
632+
if config.conf["documentFormatting"]["reportGroupings"]:
633+
# Translators: The message announced when toggling the report block quotes document formatting setting.
634+
state = _("report gorupings off")
635+
config.conf["documentFormatting"]["reportGroupings"] = False
636+
else:
637+
# Translators: The message announced when toggling the report block quotes document formatting setting.
638+
state = _("report groupings on")
639+
config.conf["documentFormatting"]["reportGroupings"] = True
640+
ui.message(state)
641+
626642
def script_toggleReportBlockQuotes(self,gesture):
627643
if config.conf["documentFormatting"]["reportBlockQuotes"]:
628644
# Translators: The message announced when toggling the report block quotes document formatting setting.

source/gui/settingsDialogs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,6 +1913,11 @@ def makeSettings(self, settingsSizer):
19131913
self.blockQuotesCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("Block &quotes")))
19141914
self.blockQuotesCheckBox.SetValue(config.conf["documentFormatting"]["reportBlockQuotes"])
19151915

1916+
# Translators: This is the label for a checkbox in the
1917+
# document formatting settings panel.
1918+
self.groupingsCheckBox = elementsGroup.addItem(wx.CheckBox(self, label=_("&Groupings")))
1919+
self.groupingsCheckBox.SetValue(config.conf["documentFormatting"]["reportGroupings"])
1920+
19161921
# Translators: This is the label for a checkbox in the
19171922
# document formatting settings panel.
19181923
self.landmarksCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("Lan&dmarks")))
@@ -1969,6 +1974,7 @@ def onSave(self):
19691974
config.conf["documentFormatting"]["reportHeadings"]=self.headingsCheckBox.IsChecked()
19701975
config.conf["documentFormatting"]["reportLists"]=self.listsCheckBox.IsChecked()
19711976
config.conf["documentFormatting"]["reportBlockQuotes"]=self.blockQuotesCheckBox.IsChecked()
1977+
config.conf["documentFormatting"]["reportGroupings"] = self.groupingsCheckBox.IsChecked()
19721978
config.conf["documentFormatting"]["reportLandmarks"]=self.landmarksCheckBox.IsChecked()
19731979
config.conf["documentFormatting"]["reportArticles"] = self.articlesCheckBox.IsChecked()
19741980
config.conf["documentFormatting"]["reportFrames"]=self.framesCheckBox.Value

source/speech/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,9 +1304,15 @@ def getControlFieldSpeech(attrs,ancestorAttrs,fieldType,formatConfig=None,extraD
13041304
),
13051305
levelText
13061306
))
1307-
elif nameText and reason==controlTypes.REASON_FOCUS and fieldType == "start_addedToControlFieldStack" and role in (controlTypes.ROLE_GROUPING, controlTypes.ROLE_PROPERTYPAGE):
1308-
# #3321, #709: Report the name of groupings (such as fieldsets) and tab pages for quicknav and focus jumps
1309-
return " ".join((nameText,roleText))
1307+
elif (
1308+
(nameText or descriptionText)
1309+
and reason == controlTypes.REASON_FOCUS
1310+
and fieldType == "start_addedToControlFieldStack"
1311+
and role in (controlTypes.ROLE_GROUPING, controlTypes.ROLE_PROPERTYPAGE)
1312+
):
1313+
# #10095, #3321, #709: Report the name and description of groupings (such as fieldsets) and tab pages
1314+
# for quicknav and focus jumps.
1315+
return " ".join((nameText, roleText, descriptionText))
13101316
elif fieldType in ("start_addedToControlFieldStack","start_relative") and role in (controlTypes.ROLE_TABLECELL,controlTypes.ROLE_TABLECOLUMNHEADER,controlTypes.ROLE_TABLEROWHEADER) and tableID:
13111317
# Table cell.
13121318
reportTableHeaders = formatConfig["reportTableHeaders"]

source/textInfos/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
6262
table = None
6363
if not table or (not formatConfig["includeLayoutTables"] and table.get("table-layout", None)) or table.get('isHidden',False):
6464
return self.PRESCAT_LAYOUT
65+
name = self.get("name")
6566
landmark = self.get("landmark")
6667
if reason in (controlTypes.REASON_CARET, controlTypes.REASON_SAYALL, controlTypes.REASON_FOCUS) and (
6768
(role == controlTypes.ROLE_LINK and not formatConfig["reportLinks"])
6869
or (role == controlTypes.ROLE_HEADING and not formatConfig["reportHeadings"])
6970
or (role == controlTypes.ROLE_BLOCKQUOTE and not formatConfig["reportBlockQuotes"])
71+
or (role == controlTypes.ROLE_GROUPING and (not name or not formatConfig["reportGroupings"]))
7072
or (role in (controlTypes.ROLE_TABLE, controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLEROWHEADER, controlTypes.ROLE_TABLECOLUMNHEADER) and not formatConfig["reportTables"])
7173
or (role in (controlTypes.ROLE_LIST, controlTypes.ROLE_LISTITEM) and controlTypes.STATE_READONLY in states and not formatConfig["reportLists"])
7274
or (role == controlTypes.ROLE_ARTICLE and not formatConfig["reportArticles"])
@@ -101,7 +103,8 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
101103
controlTypes.ROLE_MENUBUTTON,
102104
controlTypes.ROLE_TREEVIEW,
103105
controlTypes.ROLE_CHECKMENUITEM,
104-
controlTypes.ROLE_RADIOMENUITEM
106+
controlTypes.ROLE_RADIOMENUITEM,
107+
controlTypes.ROLE_CAPTION,
105108
)
106109
or (role == controlTypes.ROLE_EDITABLETEXT and controlTypes.STATE_MULTILINE not in states and (controlTypes.STATE_READONLY not in states or controlTypes.STATE_FOCUSABLE in states))
107110
or (role == controlTypes.ROLE_LIST and controlTypes.STATE_READONLY not in states)
@@ -126,6 +129,8 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
126129
elif (
127130
role in (
128131
controlTypes.ROLE_BLOCKQUOTE,
132+
controlTypes.ROLE_GROUPING,
133+
controlTypes.ROLE_FIGURE,
129134
controlTypes.ROLE_FRAME,
130135
controlTypes.ROLE_INTERNALFRAME,
131136
controlTypes.ROLE_TOOLBAR,

source/virtualBuffers/gecko_ia2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,17 @@ def _normalizeControlField(self,attrs):
9191
# This is a named link destination, not a link which can be activated. The user doesn't care about these.
9292
role=controlTypes.ROLE_TEXTFRAME
9393
level=attrs.get('IAccessible2::attribute_level',"")
94+
9495
xmlRoles=attrs.get("IAccessible2::attribute_xml-roles", "").split(" ")
9596
landmark = next((xr for xr in xmlRoles if xr in aria.landmarkRoles), None)
9697
if landmark and role != controlTypes.ROLE_LANDMARK and landmark != xmlRoles[0]:
9798
# Ignore the landmark role
9899
landmark = None
99100
if role == controlTypes.ROLE_DOCUMENT and xmlRoles[0] == "article":
100101
role = controlTypes.ROLE_ARTICLE
102+
elif role == controlTypes.ROLE_GROUPING and xmlRoles[0] == "figure":
103+
# This is a figure.
104+
role = controlTypes.ROLE_FIGURE
101105
attrs['role']=role
102106
attrs['states']=states
103107
if level is not "" and level is not None:
@@ -298,7 +302,7 @@ def _searchableAttribsForNodeType(self,nodeType):
298302
]
299303
elif nodeType=="embeddedObject":
300304
attrs=[
301-
{"IAccessible2::attribute_tag":self._searchableTagValues(["embed","object","applet","audio","video"])},
305+
{"IAccessible2::attribute_tag":self._searchableTagValues(["embed","object","applet","audio","video","figure"])},
302306
{"IAccessible::role":[oleacc.ROLE_SYSTEM_APPLICATION,oleacc.ROLE_SYSTEM_DIALOG]},
303307
]
304308
else:

0 commit comments

Comments
 (0)