Skip to content
This repository was archived by the owner on Feb 21, 2023. It is now read-only.

Commit dfd5a5f

Browse files
eeejaymcomella
authored andcommitted
Add tip and images regarding redundant navigation in TalkBack.
1 parent f72aea7 commit dfd5a5f

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

android/accessibility_guide.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ Some development tips:
2424
- Generally let the system handle focus changes: it's unintuitive when it jumps around.
2525
- Overriding the accessibility APIs in code is a code smell: generally, you can make the changes you need using the methods recommended in the docs, which provides a more maintainable and intuitive experience to users. Also note the code APIs are unintuitive and not well documented.
2626

27+
### Cut out redundant steps with `android:importantForAccessibility="no"`
28+
Unintuitively, setting some views to not be important for accessibility improves accessibility.
29+
For example, take this layout that represents a menu item that consists of an image and text.
30+
```
31+
<LinearLayout>
32+
<ImageView/>
33+
<TextView/>
34+
</LinearLayout>
35+
```
36+
When a user swipes right past this composite view, the cursor will first land on the LinearLayout, and then on the TextView:
37+
<img alt="Animation of cursor landing menu items and their text children" src="https://github.com/mozilla-mobile/shared-docs/raw/master/android/images/double-nav.gif" width="240">
38+
39+
This is both inefficient and confusing for the user, since they will encounter each item twice. To streamline this experience, set `android:importantForAccessibility="no"` on the `TextView`. This will tell TalkBack not to bother with that node:
40+
<img alt="Animation of cursor only landing on menu items" src="https://github.com/mozilla-mobile/shared-docs/raw/master/android/images/single-nav.gif" width="240">
41+
2742
## Automated testing
2843
You can regularly use [the Accessibility Scanner][scanner] to get a cursory overview of how the accessibility of your app is doing.
2944

android/images/double-nav.gif

68.2 KB
Loading

android/images/single-nav.gif

42.9 KB
Loading

0 commit comments

Comments
 (0)