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

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

Issue 2323043002: Too many accessible nodes were marked as clickable on Android (Closed)
Patch Set: Created 4 years, 3 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_android.cc
diff --git a/content/browser/accessibility/browser_accessibility_android.cc b/content/browser/accessibility/browser_accessibility_android.cc
index 991cf010d1fdacd439e518233aeabe27b3dd6c25..7ab3be80ee37daad9f763510671329638aeadc70 100644
--- a/content/browser/accessibility/browser_accessibility_android.cc
+++ b/content/browser/accessibility/browser_accessibility_android.cc
@@ -154,12 +154,8 @@ bool BrowserAccessibilityAndroid::IsChecked() const {
}
bool BrowserAccessibilityAndroid::IsClickable() const {
- if (!PlatformIsLeaf())
- return false;
-
- // We are very aggressive about returning true with IsClickable on Android
- // because there is no way to know for sure what might have a click handler.
David Tseng 2016/10/12 20:28:35 Is this no longer a concern or do you have a more
dmazzoni 2016/10/12 22:41:58 An older version of TalkBack was skipping over any
- return IsFocusable() || !GetText().empty();
+ // A node is clickable if it's focusable or if it has a default action.
+ return IsFocusable() || HasStringAttribute(ui::AX_ATTR_ACTION);
}
bool BrowserAccessibilityAndroid::IsCollapsed() const {
@@ -207,12 +203,15 @@ bool BrowserAccessibilityAndroid::IsExpanded() const {
}
bool BrowserAccessibilityAndroid::IsFocusable() const {
- bool focusable = HasState(ui::AX_STATE_FOCUSABLE);
- if (IsIframe() ||
- GetRole() == ui::AX_ROLE_WEB_AREA) {
- focusable = false;
- }
- return focusable;
+ // Don't count iframes as focusable.
+ if (IsIframe())
+ return false;
+
+ // Only the root of the tree, and not child frames, are focusable.
David Tseng 2016/10/12 20:28:35 Seems strange to have this restriction; what if a
dmazzoni 2016/10/12 22:41:58 Agreed. I changed it so that we skip iframes and c
+ if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA)
+ return !GetParent();
+
+ return HasState(ui::AX_STATE_FOCUSABLE);
}
bool BrowserAccessibilityAndroid::IsFocused() const {

Powered by Google App Engine
This is Rietveld 408576698