Accessibility-Test-Framework-for-Android
Accessibility-Test-Framework-for-Android copied to clipboard
An unexpected SpeakableText check result
For this layout, SpeakableTextPresentCheck tells me the view of "id_test1" is RESULT_ID_SHOULD_NOT_FOCUS. In fact,talkback would focus it. Is it a bug?
<RelativeLayout
android:id="@+id/id_test1"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:clickable="true">
<RelativeLayout
android:id="@+id/id_test2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/id_test3"
android:text="foo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</RelativeLayout>
Thanks for the report -- I'll take a look at what might be going on here. Just glancing at the layout, I believe I'd expect:
- No result for
id_test1, since it would be focused, but should have a spoken description of "foo" aggregated from theid_test3TextView - A
NOT_RUNresult forid_test2ofRESULT_ID_NOT_IMPORTANT_FOR_ACCESSIBILITY - A
NOT_RUNresult forid_test3ofRESULT_ID_SHOULD_NOT_FOCUS, sinceid_test1would be the focus-qualifying element which would include its text.
Would you share some info on how you're invoking SpeakableTextPresentCheck? Is this from an Espresso test, Accessibility Scanner, or something else?
Thanks for your reply. I downloaded the source code and resolved the dependency problems.I did not change any key source code. Then I ran the following code when a button clicked in a demo project without any test framework.
Set<AccessibilityHierarchyCheck> checks =AccessibilityCheckPreset.getAccessibilityHierarchyChecksForPreset(AccessibilityCheckPreset.LATEST);
AccessibilityHierarchy hierarchy = AccessibilityHierarchy.newBuilder(findViewById(R.id.id_test1)).build();
List<AccessibilityHierarchyCheckResult> results = new ArrayList<>();
for (AccessibilityHierarchyCheck check : checks) {
if(check instanceof SpeakableTextPresentCheck){
results.addAll(check.runCheckOnHierarchy(hierarchy));
}
}
and I get the result with 2 suggestions
id/id_test1,description:This item would not be focused by a screen reader id/id_test2,description:This item was not found to be important for accessibility.
I can't understand the first suggestion, because I actually focused id_test1 when using talkback,and I know it is reasonable.