Success Criterion 4.1.3 - Level AA
Status Messages
Ensure that status messages are also passed to assistive technologies. A blind user cannot see new information appearing anywhere on the screen. By providing a status message, the screen reader can announce that new information is available.
Impact
A blind users cannot see new information appear on the screen.
When showing new information, you must pass this along to assistive technologies.
Check
“Are changes on the screen indicated by assistive technologies?“
This can be tested with the screen reader.
Solution
Use accessibility announcements
On Android, you can post an accessibility message by using the AccessibilityManager
object. Create an AccessibilityEvent
, set the type to AccessibilityEvent.TYPE_ANNOUNCEMENT
and supply a message.
val type = AccessibilityEventCompat.TYPE_ANNOUNCEMENT
val event = AccessibilityEvent.obtain(type)
event.text.add("Appt announcement")
event.className = Context::class.java.name
event.packageName = packageName
val accessibilityManager = ContextCompat.getSystemService(this, AccessibilityManager::class.java)
accessibilityManager?.sendAccessibilityEvent(event)
Use accessibility live region
On Android, a live region can be set by using the convience method setAccessibilityLiveRegion
of ViewCompat
. To interrupt ingoing speech, also known as being assertive, use ACCESSIBILITY_LIVE_REGION_ASSERTIVE
. To wait for ongoing speech, also known as being polite, use ACCESSIBILITY_LIVE_REGION_POLITE
.
// Interrupt ongoing speech
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_ASSERTIVE)
// Wait for ongoing speech
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE)