@@ -65,6 +65,12 @@ 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 (
70+ attrs ['role' ] == controlTypes .Role .GROUPING
71+ and attrs .get ('IAccessible2::attribute_tag' , "" ).lower () == "figure" ):
72+ # Chromium doesn't expose the `<figure>` element as a figure.
73+ attrs ['role' ] = controlTypes .Role .FIGURE
6874 return attrs
6975
7076
@@ -154,6 +160,12 @@ def _get_states(self):
154160 return states
155161
156162
163+ class Figure (ia2Web .Ia2Web ):
164+ def _get_role (self ):
165+ return controlTypes .Role .FIGURE
166+ # return super()._get_role()
167+
168+
157169def findExtraOverlayClasses (obj , clsList ):
158170 """Determine the most appropriate class(es) for Chromium objects.
159171 This works similarly to L{NVDAObjects.NVDAObject.findOverlayClasses} except that it never calls any other findOverlayClasses method.
@@ -164,5 +176,7 @@ def findExtraOverlayClasses(obj, clsList):
164176 clsList .append (ToggleButton )
165177 elif obj .role == controlTypes .Role .LIST and obj .IA2Attributes .get ('tag' ) in ('ul' , 'dl' , 'ol' ):
166178 clsList .append (PresentationalList )
179+ elif obj .role == controlTypes .Role .GROUPING and obj .IA2Attributes .get ("tag" , "" ).casefold () == "figure" :
180+ clsList .append (Figure )
167181 ia2Web .findExtraOverlayClasses (obj , clsList ,
168182 documentClass = Document )
0 commit comments