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

Unified Diff: chrome/browser/resources/chromeos/switch_access/tree_walker.js

Issue 2818503002: Improved isInteresting heuristic, made more AutomationNodes focusable (Closed)
Patch Set: Responded to comment Created 3 years, 8 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: chrome/browser/resources/chromeos/switch_access/tree_walker.js
diff --git a/chrome/browser/resources/chromeos/switch_access/tree_walker.js b/chrome/browser/resources/chromeos/switch_access/tree_walker.js
index ce8237d798caa62c4a6254fa95f20a4b5366199a..5fc9f1f1d44316a6d0beab9c56a4c1b501bc89fe 100644
--- a/chrome/browser/resources/chromeos/switch_access/tree_walker.js
+++ b/chrome/browser/resources/chromeos/switch_access/tree_walker.js
@@ -116,11 +116,32 @@ AutomationTreeWalker.prototype = {
* Returns true if |node| is interesting.
*
* @param {!chrome.automation.AutomationNode} node
- * @return {boolean|undefined}
+ * @return {boolean}
* @private
*/
isInteresting_: function(node) {
- return node.state && node.state.focusable;
+ let loc = node.location;
+ let parent = node.parent;
+ let root = node.root;
+ let role = node.role;
+ let state = node.state;
+
+ // Skip things that are offscreen
+ if (state[chrome.automation.StateType.OFFSCREEN]
+ || loc.top < 0 || loc.left < 0)
+ return false;
+
+ if (parent) {
+ // crbug.com/710559
+ // Work around for browser tabs
+ if (role === chrome.automation.RoleType.TAB
+ && parent.role === chrome.automation.RoleType.TAB_LIST
+ && root.role === chrome.automation.RoleType.DESKTOP)
+ return true;
+ }
+
+ // The general rule that applies to everything.
+ return state[chrome.automation.StateType.FOCUSABLE] === true;
},
/**

Powered by Google App Engine
This is Rietveld 408576698