Commit e876cba5 authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

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.

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 <dmazzoni@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814732}
parent d50971be
...@@ -361,10 +361,22 @@ class NavigationManager { ...@@ -361,10 +361,22 @@ class NavigationManager {
this.desktop_, chrome.automation.EventType.FOCUS, this.desktop_, chrome.automation.EventType.FOCUS,
this.onFocusChange_.bind(this)); this.onFocusChange_.bind(this));
// ARC++ fires SCROLL_POSITION_CHANGED.
new RepeatedEventHandler( new RepeatedEventHandler(
this.desktop_, chrome.automation.EventType.SCROLL_POSITION_CHANGED, this.desktop_, chrome.automation.EventType.SCROLL_POSITION_CHANGED,
this.onScrollChange_.bind(this)); 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( new RepeatedTreeChangeHandler(
chrome.automation.TreeChangeObserverFilter.ALL_TREE_CHANGES, chrome.automation.TreeChangeObserverFilter.ALL_TREE_CHANGES,
this.onTreeChange_.bind(this), { this.onTreeChange_.bind(this), {
......
...@@ -34,7 +34,7 @@ class ComboBoxNode extends BasicNode { ...@@ -34,7 +34,7 @@ class ComboBoxNode extends BasicNode {
super.onFocus(); super.onFocus();
this.expandedChangedHandler_ = new RepeatedEventHandler( this.expandedChangedHandler_ = new RepeatedEventHandler(
this.automationNode, chrome.automation.EventType.EXPANDED_CHANGED, this.automationNode, chrome.automation.EventType.EXPANDED,
() => this.onExpandedChanged(), {exactMatch: true}); () => this.onExpandedChanged(), {exactMatch: true});
this.automationNode.focus(); this.automationNode.focus();
} }
......
...@@ -156,7 +156,7 @@ class KeyboardRootNode extends BasicRootNode { ...@@ -156,7 +156,7 @@ class KeyboardRootNode extends BasicRootNode {
SwitchAccessPredicate.isVisible(keyboardObject); SwitchAccessPredicate.isVisible(keyboardObject);
new EventHandler( new EventHandler(
keyboardObject, chrome.automation.EventType.ARIA_ATTRIBUTE_CHANGED, keyboardObject, chrome.automation.EventType.STATE_CHANGED,
KeyboardRootNode.checkVisibilityChanged_, {exactMatch: true}) KeyboardRootNode.checkVisibilityChanged_, {exactMatch: true})
.start(); .start();
} }
......
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