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

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

Issue 2469383002: Android accessibility: skip the root element when it has no title (Closed)
Patch Set: Fix two test expectations Created 4 years, 1 month 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
« no previous file with comments | « no previous file | content/test/data/accessibility/aria/aria-none-expected-android.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/browser_accessibility_android.cc
diff --git a/content/browser/accessibility/browser_accessibility_android.cc b/content/browser/accessibility/browser_accessibility_android.cc
index fc3716588dce7707b4f988bca1b77442b7b4dc02..4c873c94eefe6ae62e793283f9d1a5fa65c36fed 100644
--- a/content/browser/accessibility/browser_accessibility_android.cc
+++ b/content/browser/accessibility/browser_accessibility_android.cc
@@ -278,6 +278,11 @@ bool BrowserAccessibilityAndroid::IsVisibleToUser() const {
}
bool BrowserAccessibilityAndroid::IsInterestingOnAndroid() const {
+ // The root is not interesting if it doesn't have a title, even
+ // though it's focusable.
+ if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && GetText().empty())
+ return false;
+
// Focusable nodes are always interesting. Note that IsFocusable()
// already skips over things like iframes and child frames that are
// technically focusable but shouldn't be exposed as focusable on Android.
@@ -453,6 +458,13 @@ base::string16 BrowserAccessibilityAndroid::GetText() const {
if (text.empty())
text = value;
+ // If this is the root element, give up now, allow it to have no
+ // accessible text. For almost all other focusable nodes we try to
+ // get text from contents, but for the root element that's redundant
+ // and often way too verbose.
+ if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA)
+ return text;
+
// This is called from PlatformIsLeaf, so don't call PlatformChildCount
// from within this!
if (text.empty() && (HasOnlyTextChildren() ||
« no previous file with comments | « no previous file | content/test/data/accessibility/aria/aria-none-expected-android.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698