Commit 482e46c0 authored by Hiroki Sato's avatar Hiroki Sato Committed by Commit Bot

arc-a11y: Don't compute name from descendants for ScrollableContainer

CL:2222068 modified ARC++ focusability and accessibility name
computation.
In that change, we introduced concepts of ScrollableContainer and
ToplevelScrollIem. For ToplevelScrollItems, we compute its a11y name
from descendants if necessary. So we shouldn't do it for
ScrollableContainers, but we're not checking it.

This CL fixes the bug.

Bug: b:152930082
Test: unit_tests --gtest_filter="AXTreeSourceArcTest.*"
Test: manual. Open PlayStore, and open "About this app" dialog from app detail page. Each text nodes gets focus from ChromeVox.
Change-Id: Idb84b30c2461e73d6be5f929546c3af712cf2a83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253681
Commit-Queue: Hiroki Sato <hirokisato@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Reviewed-by: default avatarSara Kato <sarakato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781095}
parent c10ef92a
...@@ -101,7 +101,7 @@ bool AccessibilityNodeInfoDataWrapper::CanBeAccessibilityFocused() const { ...@@ -101,7 +101,7 @@ bool AccessibilityNodeInfoDataWrapper::CanBeAccessibilityFocused() const {
bool AccessibilityNodeInfoDataWrapper::IsAccessibilityFocusableContainer() bool AccessibilityNodeInfoDataWrapper::IsAccessibilityFocusableContainer()
const { const {
if (!IsImportantInAndroid()) if (!IsImportantInAndroid() || (IsScrollableContainer() && !HasText()))
return false; return false;
return GetProperty(AXBooleanProperty::SCREEN_READER_FOCUSABLE) || return GetProperty(AXBooleanProperty::SCREEN_READER_FOCUSABLE) ||
......
...@@ -524,6 +524,16 @@ TEST_F(AXTreeSourceArcTest, AccessibleNameComputationFromDescendants) { ...@@ -524,6 +524,16 @@ TEST_F(AXTreeSourceArcTest, AccessibleNameComputationFromDescendants) {
data = GetSerializedNode(child2->id); data = GetSerializedNode(child2->id);
ASSERT_TRUE(data.IsIgnored()); ASSERT_TRUE(data.IsIgnored());
// Don't compute name from descendants for scrollable, e.g. ScrollView.
SetProperty(root, AXBooleanProperty::SCROLLABLE, true);
CallNotifyAccessibilityEvent(event.get());
data = GetSerializedNode(root->id);
ASSERT_FALSE(
data.GetStringAttribute(ax::mojom::StringAttribute::kName, &name));
SetProperty(root, AXBooleanProperty::SCROLLABLE, false);
// If one child is clickable, do not use clickable child. // If one child is clickable, do not use clickable child.
SetProperty(child1, AXBooleanProperty::CLICKABLE, true); SetProperty(child1, AXBooleanProperty::CLICKABLE, true);
......
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