SPEAKER: In order for Android's Accessibility Services
to work properly, labels need to be both precise and concise.
If a graphical element on the screen
doesn't have a content description,
it can be difficult for users of Accessibility Services navigate
and use your app.
In this example, we'll see how TalkBack navigates an app
and how proper content descriptions can
improve the user's experience.
Let's briefly recap how a blind or low-vision user interacts
with their device using a screen reader such as TalkBack.
When using TalkBack, users discover
content by moving their fingers across the device screen.
TalkBack announces the views and the user
interacts with those views using gestures.
Now, let's see TalkBack in action
by navigating to the Settings screen with TalkBack enabled.
We can see that when the user navigates to the File a Bug
button, TalkBack announces the text,
and the user can clearly understand
the purpose of the button.
Now, let's try navigating a different screen
with TalkBack enabled.
Here we are in a screen of tasks.
And there's a floating action button on the bottom right.
In this example, the floating action button only
contains an icon and no text.
Without providing a content label for the button,
TalkBack can't announce the intent of this button.
As we saw in the previous example
with the File a Bug button, text rendered
in TextViews or its subclasses is automatically
provided to Accessibility Services,
so there's no need to provide content labels.
However, it's important to provide
content labels for ImageViews, ImageButtons,
or any other view that convey meaningful or actionable
information through graphics.
Take this ImageView for example.
This ImageView is an Add icon, and when tapped,
should take the user to a new screen to add a task.
Since this view is associated with an action,
we should indicate what the view does when it's tapped.
Keep in mind that labels should be both precise and concise.
So instead of labeling this button as Add,
we labeled it as Add Task.
Add Task is still a brief description
but helps provide the extra context for what exactly
this button does.
In general, if an image has meaningful content,
we should provide a content description.
If an image does not contain meaningful information,
such as an action it performs, you
can specify so with attribute contentDescription equals null.
This attribute can be useful for elements
such as decorative images or section dividers.
Now that you have a better idea of when
to use content descriptions, let's talk
about how to best formulate content descriptions.
First, always use a localized string
by utilizing string resources.
This allows a string to be translated
to the user's locale.
Second, keep labels concise.
Unnecessarily verbose descriptions
can actually degrade the experience
for blind and low-vision users.
Third, don't include the control type, such as Button.
A screen reader like TalkBack would generally
announce that on its own.
Fourth, don't include interaction modes--
for example, Click to Add Task.
Not everyone interacts with the device the same way,
and there are multiple Accessibility Services
besides TalkBack that the user may be
using to interact with the app.
Fifth, don't include states such as on or off.
State description is already built into views.
And we'll be covering proper state communication
in a future episode.
With these best practices in mind,
the next step is to test your content descriptions in action.
The best way to test whether your app has
precise and concise labels for each element
is by manually navigating through your app
with an accessibility service such as TalkBack.
And we'll be covering TalkBack in detail in a future episode.
In summary, be sure meaningful non-text views have a content
description so that Accessibility Service
users can properly navigate and use your app.
Second, put some thought into your content descriptions
to make them both precise and concise.
And third, always try using your app
with a service such as TalkBack to better understand
the user experience.
In our next episode, we'll take a look
at labeling other views in your Android app.