Use panel or unknown AtkRole for nodes with unknown roles
Typically, Views nodes that have an unknown role are one of a variety
of views. The ATK_ROLE_PANEL is a more accurate classification for
these. For other nodes with an unknown role we can use ATK_ROLE_UNKNOWN.
Bug: 866344
Change-Id: Ifae26ec0f04487abfec86d57df7914ab459967cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1741921
Reviewed-by: Joanmarie Diggs <jdiggs@igalia.com>
Commit-Queue: Martin Robinson <mrobinson@igalia.com>
Cr-Commit-Position: refs/heads/master@{#685261}
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc b/ui/accessibility/platform/ax_platform_node_auralinux.cc
index e7f39053..43b7a99 100644
--- a/ui/accessibility/platform/ax_platform_node_auralinux.cc
+++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc
@@ -2584,10 +2584,13 @@
return ATK_ROLE_PANEL;
case ax::mojom::Role::kFigcaption:
return ATK_ROLE_CAPTION;
+ case ax::mojom::Role::kUnknown:
+ // When we are not in web content, assume that a node with an unknown
+ // role is a view (which often have the unknown role).
+ return !GetDelegate()->IsWebContent() ? ATK_ROLE_PANEL : ATK_ROLE_UNKNOWN;
case ax::mojom::Role::kKeyboard:
case ax::mojom::Role::kNone:
case ax::mojom::Role::kPresentational:
- case ax::mojom::Role::kUnknown:
return ATK_ROLE_REDUNDANT_OBJECT;
}
}