arc-a11y: android_focused_id_ to remain unchanged if adjusted node is
invalid. On a focus event, AXTreeSource searches the first a11y focusable node under the event source. When no focusable node is found, it sets the focus on the event source node, but it invoked undesired behavior. For instance, in ArcSettings application focus was requested, by sending a requestFocus() event. This results in android_focused_id_ being computed again in ax_tree_source_arc. However as this is forced focused event, sometimes the new node is not valid. In this case, rather than default back to the event_source (and move the focus there), the focus should remain unchanged. Removing requestFocus() would cause undesired behaviors in other areas of the app. This CL adds a change, so that when no focusable node is found under the focus event source node, we don't change focus so that it won't invoke unexpected behavior. Note that the a11y event of type FOCUSED can be dispatched in various ways (e.g. via ViewParent#requestSendAccessibilityEvent is another way to request the a11y event). Also, even if it's not the "forced" focus event, technically FindFirstFocusableNode can return null as we're doing different computation than the Android framework. This change also fixes HasText() computation in CanBeAccessibilityFocused. AX-Relnotes: n/a. Bug: b:156562991 Test: Manual. Open arc settings and observe no scrolling Test: AXTreeSourceArcTest.* Change-Id: If07e0c342dab929bf6f516a1753beda31bd9522f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2291552 Commit-Queue: Sara Kato <sarakato@chromium.org> Reviewed-by:Hiroki Sato <hirokisato@chromium.org> Cr-Commit-Position: refs/heads/master@{#788564}
Showing
Please register or sign in to comment