Skip to content

Commit 1fb40c1

Browse files
authored
Merge 6723a1e into acfca7b
2 parents acfca7b + 6723a1e commit 1fb40c1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

source/NVDAObjects/IAccessible/chromium.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def _normalizeControlField(self, attrs):
6565
if attrs['role'] == controlTypes.Role.TOGGLEBUTTON and controlTypes.State.CHECKABLE in attrs['states']:
6666
# In Chromium, the checkable state is exposed erroneously on toggle buttons.
6767
attrs['states'].discard(controlTypes.State.CHECKABLE)
68+
69+
if attrs['role'] == controlTypes.Role.GROUPING and attrs.get('IAccessible2::attribute_tag', "").lower() == "figure":
70+
# Chromium doesn't expose the `<figure>` element as a figure.
71+
log.debug(attrs['role'])
72+
attrs['role'] = controlTypes.Role.FIGURE
6873
return attrs
6974

7075

@@ -154,6 +159,12 @@ def _get_states(self):
154159
return states
155160

156161

162+
class Figure(ia2Web.Ia2Web):
163+
def _get_role(self):
164+
return controlTypes.Role.FIGURE
165+
# return super()._get_role()
166+
167+
157168
def findExtraOverlayClasses(obj, clsList):
158169
"""Determine the most appropriate class(es) for Chromium objects.
159170
This works similarly to L{NVDAObjects.NVDAObject.findOverlayClasses} except that it never calls any other findOverlayClasses method.
@@ -164,5 +175,7 @@ def findExtraOverlayClasses(obj, clsList):
164175
clsList.append(ToggleButton)
165176
elif obj.role == controlTypes.Role.LIST and obj.IA2Attributes.get('tag') in ('ul', 'dl', 'ol'):
166177
clsList.append(PresentationalList)
178+
elif obj.role == controlTypes.Role.GROUPING and obj.IA2Attributes.get("tag", "").casefold() == "figure":
179+
clsList.append(Figure)
167180
ia2Web.findExtraOverlayClasses(obj, clsList,
168181
documentClass=Document)

0 commit comments

Comments
 (0)