Merge to M87: Fix automation event listeners in Switch Access
In http://crrev.com/c/2424854 ("Refactor chrome.automation.EventType"),
we simplified the mappings from ax.mojom.Event and EventGenerator
events.
However, a minor oversight was that the previous code mapped some
generated events into automation events with different names. With
the new code, they map to an automation event with the same name -
but the old names still exist so they didn't generate a compile
error.
To ensure this was comprehensive, I wrote some code to log all of
the event mappings before and after the patch, and did a diff to
look for discrepancies. The diff is here -
https://paste.googleplex.com/6408048659660800 - but the only
relevant ones are:
- ariaAttributeChanged
- expandedChanged
- scrollPositionChanged
This patch fixes any instances of those three events in
Switch Access in particular. This fixes at regressions
with combo boxes and the virtual keyboard.
(cherry picked from commit e876cba52c989cf508f099edaeb1016ef2dccaad)
Bug: 1110367, 1135248
AX-Relnotes: none because it just fixes a regression
Change-Id: I5e3a3b98edb8d9fcdc3ad55b28ad2ce476da7e14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450663
Commit-Queue: Dominic Mazzoni <[email protected]>
Reviewed-by: David Tseng <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#814732}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472915
Reviewed-by: Dominic Mazzoni <[email protected]>
Cr-Commit-Position: refs/branch-heads/4280@{#401}
Cr-Branched-From: ea420fb963f9658c9969b6513c56b8f47efa1a2a-refs/heads/master@{#812852}
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/navigation_manager.js b/chrome/browser/resources/chromeos/accessibility/switch_access/navigation_manager.js
index 2e3431a..37feb8e2 100644
--- a/chrome/browser/resources/chromeos/accessibility/switch_access/navigation_manager.js
+++ b/chrome/browser/resources/chromeos/accessibility/switch_access/navigation_manager.js
@@ -360,10 +360,22 @@
this.desktop_, chrome.automation.EventType.FOCUS,
this.onFocusChange_.bind(this));
+ // ARC++ fires SCROLL_POSITION_CHANGED.
new RepeatedEventHandler(
this.desktop_, chrome.automation.EventType.SCROLL_POSITION_CHANGED,
this.onScrollChange_.bind(this));
+ // Web and Views use AXEventGenerator, which fires
+ // separate horizontal and vertical events.
+ new RepeatedEventHandler(
+ this.desktop_,
+ chrome.automation.EventType.SCROLL_HORIZONTAL_POSITION_CHANGED,
+ this.onScrollChange_.bind(this));
+ new RepeatedEventHandler(
+ this.desktop_,
+ chrome.automation.EventType.SCROLL_VERTICAL_POSITION_CHANGED,
+ this.onScrollChange_.bind(this));
+
new RepeatedTreeChangeHandler(
chrome.automation.TreeChangeObserverFilter.ALL_TREE_CHANGES,
this.onTreeChange_.bind(this), {
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/combo_box_node.js b/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/combo_box_node.js
index c6e1dfa08..b7d8e273f 100644
--- a/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/combo_box_node.js
+++ b/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/combo_box_node.js
@@ -34,7 +34,7 @@
super.onFocus();
this.expandedChangedHandler_ = new RepeatedEventHandler(
- this.automationNode, chrome.automation.EventType.EXPANDED_CHANGED,
+ this.automationNode, chrome.automation.EventType.EXPANDED,
() => this.onExpandedChanged(), {exactMatch: true});
this.automationNode.focus();
}
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/keyboard_node.js b/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/keyboard_node.js
index a9c6dba5..5cc3881cb 100644
--- a/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/keyboard_node.js
+++ b/chrome/browser/resources/chromeos/accessibility/switch_access/nodes/keyboard_node.js
@@ -156,7 +156,7 @@
SwitchAccessPredicate.isVisible(keyboardObject);
new EventHandler(
- keyboardObject, chrome.automation.EventType.ARIA_ATTRIBUTE_CHANGED,
+ keyboardObject, chrome.automation.EventType.STATE_CHANGED,
KeyboardRootNode.checkVisibilityChanged_, {exactMatch: true})
.start();
}