Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: content/browser/accessibility/browser_accessibility.cc

Issue 2120523002: The children of non-editable combo boxes, search boxes and text fields should not be hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Windows browser test. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
« no previous file with comments | « content/browser/accessibility/browser_accessibility.h ('k') | content/browser/accessibility/browser_accessibility_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698