This document is in beta. Help us by reporting issues via Github or email
On this page:
Make sure status messages are identified in code, so that assistive technologies can convey them to users.
There are different situations where a status message need to be shown in a way that screen readers understand. For example:
These messages need to be conveyed to users without disturbing the user’s position on a page.
Screen reader announcements (using ARIA Live regions for the Web, for example) should be used to inform screen reader users of these events without disrupting their position on the page.
4.1.3 Status Messages: In content implemented using markup languages, status messages can be programmatically determined through role or properties such that they can be presented to the user by assistive technologies without receiving focus. (Level AA)
See the W3C’s detailed explanation of this guideline with techniques and examples.
This section needs more content. Contribute via Github or email.
This section needs more content. Contribute via Github or email.
You can use a live region in order to send a new AccessibilityEvent
to the current enabled Accessibility Service on view updates. This means that any service like TalkBack will pay attention to any changes in that View and will automatically announce them.
To do so, you can easily mark any View as a live region in your XML file by adding the accessibilityLiveRegion
attribute:
<View
...
android:accessibilityLiveRegion="polite"
.../>
Options for this attribute are the following:
none
: Accessibility services should not announce changes to this view.polite
: Accessibility services should announce changes to this view.assertive
: Accessibility services should interrupt ongoing speech to immediately announce changes to this view.Carefully consider when to use live regions, as announcements for frequently changing views can be disruptive and annoying. Live regions can easily be overused, especially when you’re just starting out with accessibility. Live regions are the exception, not the rule.
Widgets with built in error messages such as TextField()
in a Form()
widget have their errors read out automatically when the validator: (value) {}
returns a error string.
The same can be said for the AlertDialog
widget.
SemanticsService.announce( String, TextDirection.ltr); // the text direction should be based on some sort of localization setting.
The following are different situations you will need to cover:
When a status message tells the user something is successful or is the results of an action. This can also be used for a state change when part of a page updates:
You can use these following techniques:
Use the ARIA role=”status” to present status messages in combination with the technique Providing success feedback when data is submitted successfully.
NOTE: There may be times when the best user experience is to move focus to a message, such as an error, as a part of form validation etc. See the GDS’ Error Summary component and guidance for an example.
Use the following techniques:
Use ARIA role=”alert” or Live Regions to Identify Errors in combination with any of the following:
The ARIA role="progressbar"
can be used but may not be enough on its own (depending on support by browsers and assistive technologies). For some examples of progressbar
role see:
You can use the following techniques:
role="alert"
or aria-live="assertive"
on content which is not important.This document is in beta. Help us by reporting issues via Github or email