Commit ba049856 authored by dmazzoni's avatar dmazzoni Committed by Commit bot

Always send TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED.

This logic was borrowed from ExploreByTouchHelper, but apparently it's wrong,
because TalkBack sends ACTION_ACCESSIBILITY_FOCUS on a new view id and
then ACTION_CLEAR_ACCESSIBILITY_FOCUS on the old view id, and since we didn't
think the old view had accessibility focus, we never responded with
a TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED event, so the framework would sometimes
not update its cache, and TalkBack could think the old view still had
accessibility focus.

BUG=458343

Review URL: https://codereview.chromium.org/916213003

Cr-Commit-Position: refs/heads/master@{#316238}
parent 7a1787ed
......@@ -211,9 +211,11 @@ public class BrowserAccessibilityManager {
}
return true;
case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS:
// ALWAYS respond with TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED whether we thought
// it had focus or not, so that the Android framework cache is correct.
sendAccessibilityEvent(virtualViewId,
AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
if (mAccessibilityFocusId == virtualViewId) {
sendAccessibilityEvent(mAccessibilityFocusId,
AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
mAccessibilityFocusId = View.NO_ID;
mAccessibilityFocusRect = null;
}
......
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