Commit 248197f6 authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Commit Bot

[Switch Access] Add base implementation for isValidAndVisible

Codify the expectation that isValidAndVisible() == true implies that
location !== undefined.

AX-Relnotes: n/a.
Bug: None.
Change-Id: I7ba047b47b82086699f1c17a48263f76f6a9773e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2248349
Commit-Queue: Akihiro Ota <akihiroota@chromium.org>
Auto-Submit: Anastasia Helfinstein <anastasi@google.com>
Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779875}
parent eaf0a6b2
......@@ -67,11 +67,6 @@ class BackButtonNode extends SAChildNode {
return false;
}
/** @override */
isValidAndVisible() {
return this.automationNode !== null && !!this.location;
}
/** @override */
onFocus() {
super.onFocus();
......
......@@ -103,7 +103,7 @@ class GroupNode extends SAChildNode {
isValidAndVisible() {
for (const child of this.children_) {
if (child.isValidAndVisible()) {
return !!this.location;
return super.isValidAndVisible();
}
}
return false;
......
......@@ -114,7 +114,8 @@ class NodeWrapper extends SAChildNode {
if (!this.baseNode_.role) {
return false;
}
return SwitchAccessPredicate.isVisible(this.baseNode_);
return SwitchAccessPredicate.isVisible(this.baseNode_) &&
super.isValidAndVisible();
}
/** @override */
......
......@@ -147,9 +147,10 @@ class SAChildNode {
* Returns whether this node is still both valid and visible onscreen (e.g.
* not hidden, not offscreen, not invisible)
* @return {boolean}
* @abstract
*/
isValidAndVisible() {}
isValidAndVisible() {
return !!this.location;
}
/**
* Called when this node becomes the primary highlighted node.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment