Skip to content

Commit 67ea95b

Browse files
authored
Merge 3213e4f into 5a0b42e
2 parents 5a0b42e + 3213e4f commit 67ea95b

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
@@ -7,8 +7,6 @@
77
import controlTypes
88

99
ariaRolesToNVDARoles={
10-
"description":controlTypes.ROLE_STATICTEXT,
11-
"search":controlTypes.ROLE_SECTION,
1210
"alert":controlTypes.ROLE_ALERT,
1311
"alertdialog":controlTypes.ROLE_DIALOG,
1412
"application":controlTypes.ROLE_APPLICATION,
@@ -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
@@ -171,6 +174,9 @@
171174
controlTypes.ROLE_INSERTED_CONTENT: _("ins"),
172175
# Translators: Displayed in braille for a landmark.
173176
controlTypes.ROLE_LANDMARK: _("lmk"),
177+
# Translators: Displayed in braille for an object which is a
178+
# figure.
179+
controlTypes.ROLE_FIGURE: _("fig"),
174180
}
175181

176182
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
reportFrames = boolean(default=true)
186187
reportClickable = boolean(default=true)

source/controlTypes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
ROLE_DELETED_CONTENT=147
154154
ROLE_INSERTED_CONTENT=148
155155
ROLE_LANDMARK = 149
156+
ROLE_FIGURE = 151
156157

157158
STATE_UNAVAILABLE=0X1
158159
STATE_FOCUSED=0X2
@@ -495,6 +496,8 @@
495496
ROLE_INSERTED_CONTENT:_("inserted"),
496497
# Translators: Identifies a landmark.
497498
ROLE_LANDMARK: _("landmark"),
499+
# Translators: Identifies a figure (commonly seen on some websites).
500+
ROLE_FIGURE: _("figure"),
498501
}
499502

500503
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")))
@@ -1964,6 +1969,7 @@ def onSave(self):
19641969
config.conf["documentFormatting"]["reportHeadings"]=self.headingsCheckBox.IsChecked()
19651970
config.conf["documentFormatting"]["reportLists"]=self.listsCheckBox.IsChecked()
19661971
config.conf["documentFormatting"]["reportBlockQuotes"]=self.blockQuotesCheckBox.IsChecked()
1972+
config.conf["documentFormatting"]["reportGroupings"] = self.groupingsCheckBox.IsChecked()
19671973
config.conf["documentFormatting"]["reportLandmarks"]=self.landmarksCheckBox.IsChecked()
19681974
config.conf["documentFormatting"]["reportFrames"]=self.framesCheckBox.Value
19691975
config.conf["documentFormatting"]["reportClickable"]=self.clickableCheckBox.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 in (controlTypes.ROLE_FRAME, controlTypes.ROLE_INTERNALFRAME) and not formatConfig["reportFrames"])
@@ -100,7 +102,8 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
100102
controlTypes.ROLE_MENUBUTTON,
101103
controlTypes.ROLE_TREEVIEW,
102104
controlTypes.ROLE_CHECKMENUITEM,
103-
controlTypes.ROLE_RADIOMENUITEM
105+
controlTypes.ROLE_RADIOMENUITEM,
106+
controlTypes.ROLE_CAPTION,
104107
)
105108
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))
106109
or (role == controlTypes.ROLE_LIST and controlTypes.STATE_READONLY not in states)
@@ -125,6 +128,8 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
125128
elif (
126129
role in (
127130
controlTypes.ROLE_BLOCKQUOTE,
131+
controlTypes.ROLE_GROUPING,
132+
controlTypes.ROLE_FIGURE,
128133
controlTypes.ROLE_FRAME,
129134
controlTypes.ROLE_INTERNALFRAME,
130135
controlTypes.ROLE_TOOLBAR,

source/virtualBuffers/gecko_ia2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,15 @@ 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
100+
if role == controlTypes.ROLE_GROUPING and xmlRoles[0] == "figure":
101+
# This is a figure.
102+
role = controlTypes.ROLE_FIGURE
99103
attrs['role']=role
100104
attrs['states']=states
101105
if level is not "" and level is not None:
@@ -292,7 +296,7 @@ def _searchableAttribsForNodeType(self,nodeType):
292296
]
293297
elif nodeType=="embeddedObject":
294298
attrs=[
295-
{"IAccessible2::attribute_tag":self._searchableTagValues(["embed","object","applet","audio","video"])},
299+
{"IAccessible2::attribute_tag":self._searchableTagValues(["embed","object","applet","audio","video","figure"])},
296300
{"IAccessible::role":[oleacc.ROLE_SYSTEM_APPLICATION,oleacc.ROLE_SYSTEM_DIALOG]},
297301
]
298302
else:

0 commit comments

Comments
 (0)