Commit b2c809dd authored by Hiroki Sato's avatar Hiroki Sato Committed by Commit Bot

arc-a11y: Fix importance computation of input focused node

When ARC node has input focus but it doesn't have any name or text, the
node was ignored because HasImportantProperty checked focusability only
from whether it's FOCUS actionable or not.

This CL fixes this by adding more conditions so that such a node becomes
important.

Bug: b:154173452
Test: manual. Open talkback-test-app "Common Widgets" and input focused Sliders are accessible.
Change-Id: I3fcb57f42647a428bd4f7de73a30c4901b1a6efa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2153450
Commit-Queue: Hiroki Sato <hirokisato@chromium.org>
Reviewed-by: default avatarSara Kato <sarakato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759956}
parent 68c73621
......@@ -146,22 +146,31 @@ bool HasImportantProperty(AXNodeInfoData* node) {
if (!node)
return false;
// These properties are used to compute accessibility name in
// AccessibilityNodeInfoDataWrapper.
// TODO(hirokisato): Also check LABELED_BY.
if (HasNonEmptyStringProperty(node, AXStringProperty::CONTENT_DESCRIPTION) ||
HasNonEmptyStringProperty(node, AXStringProperty::TEXT) ||
HasNonEmptyStringProperty(node, AXStringProperty::PANE_TITLE) ||
HasNonEmptyStringProperty(node, AXStringProperty::HINT_TEXT))
HasNonEmptyStringProperty(node, AXStringProperty::HINT_TEXT)) {
return true;
}
if (GetBooleanProperty(node, AXBooleanProperty::EDITABLE) ||
GetBooleanProperty(node, AXBooleanProperty::CHECKABLE) ||
GetBooleanProperty(node, AXBooleanProperty::SELECTED))
// These properties are sorted in the same order of mojom file.
if (GetBooleanProperty(node, AXBooleanProperty::CHECKABLE) ||
GetBooleanProperty(node, AXBooleanProperty::FOCUSABLE) ||
GetBooleanProperty(node, AXBooleanProperty::SELECTED) ||
GetBooleanProperty(node, AXBooleanProperty::EDITABLE)) {
return true;
}
if (HasStandardAction(node, AXActionType::CLICK) ||
HasStandardAction(node, AXActionType::FOCUS))
if (HasStandardAction(node, AXActionType::FOCUS) ||
HasStandardAction(node, AXActionType::CLEAR_FOCUS) ||
HasStandardAction(node, AXActionType::CLICK)) {
return true;
}
// TODO(hirokisato) Also check LABELED_BY and ui::IsControl(role)
// TODO(hirokisato): Consider to check ui::IsControl(role).
return false;
}
......
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