Index: content/browser/accessibility/browser_accessibility.cc |
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc |
index bead70f80cbb592797d21544549e7090ecdc925f..d7d47c1d84339ca07d994b8314fd408f747dea77 100644 |
--- a/content/browser/accessibility/browser_accessibility.cc |
+++ b/content/browser/accessibility/browser_accessibility.cc |
@@ -70,7 +70,10 @@ bool BrowserAccessibility::PlatformIsLeaf() const { |
// implementation details, but we want to expose them as leaves to platform |
// accessibility APIs because screen readers might be confused if they find |
// any children. |
- if (IsSimpleTextControl() || IsTextOnlyObject()) |
+ // Note that if a combo box, search box or text field are not native, they |
+ // might present a menu of choices using aria-owns which should not be hidden |
+ // from tree. |
+ if (IsNativeTextControl() || IsTextOnlyObject()) |
return true; |
// Roles whose children are only presentational according to the ARIA and |
@@ -1064,6 +1067,20 @@ bool BrowserAccessibility::IsMenuRelated() const { |
} |
} |
+bool BrowserAccessibility::IsNativeTextControl() const { |
+ const std::string& html_tag = GetStringAttribute(ui::AX_ATTR_HTML_TAG); |
+ if (html_tag == "input") { |
+ std::string input_type; |
+ if (!GetHtmlAttribute("type", &input_type)) |
+ return true; |
+ return input_type.empty() || input_type == "email" || |
+ input_type == "password" || input_type == "search" || |
+ input_type == "tel" || input_type == "text" || input_type == "url" || |
+ input_type == "number"; |
+ } |
+ return html_tag == "textarea"; |
+} |
+ |
bool BrowserAccessibility::IsSimpleTextControl() const { |
// Time fields, color wells and spinner buttons might also use text fields as |
// constituent parts, but they are not considered text fields as a whole. |