Commit 7eb1a5af authored by dtseng's avatar dtseng Committed by Commit bot

Always retarget blur events to the root of the focused node

Given events a_1, .., a_n that come in in the same update,
where a_i is a blur and a_j is focus (i < j).

Then, a_i's update params focused id will point to a_j's node.

As a result, we never actually fire a_j properly since it was seen as "already" focused.

TEST=navigate context menus in files app.
BUG=668775

Review-Url: https://codereview.chromium.org/2575233002
Cr-Commit-Position: refs/heads/master@{#439116}
parent 626379c7
......@@ -93,6 +93,14 @@ automationUtil.updateFocusedNode = function() {
automationUtil.focusedNode = automationUtil.getFocus();
};
/**
* Updates the focus on blur.
*/
automationUtil.updateFocusedNodeOnBlur = function() {
var focus = automationUtil.getFocus();
automationUtil.focusedNode = focus ? focus.root : null;
};
automation.registerCustomHook(function(bindingsAPI) {
var apiFunctions = bindingsAPI.apiFunctions;
......@@ -287,7 +295,7 @@ automationInternal.onAccessibilityEvent.addListener(function(eventParams) {
// events but otherwise not handle blur events specially.
var node = privates(targetTree).impl.get(eventParams.targetID);
if (node == node.root)
isFocusEvent = true;
automationUtil.updateFocusedNodeOnBlur();
} else if (eventParams.eventType == schema.EventType.mediaStartedPlaying ||
eventParams.eventType == schema.EventType.mediaStoppedPlaying) {
// These events are global to the tree.
......
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