Users of assistive technologies should be made aware of important changes in content through accessibility announcements. What happens next depends on the active assistive technology. The screen reader for example, will read the message aloud.
Relates to 3.3.1, 4.1.3
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)
On iOS, you post an accessibility message by using the UIAccessibility
object. The post
method can be used to post data to assistive technologies. Set the type to announcement
and supply a string
argument to announce something.
UIAccessibility.post(notification: .announcement, argument: "Appt announcement")
With Flutter, you can post an accessibility message by using the SemanticsService
object. Use the announce
method to post an accessibility announcement.
SemanticsService.announce('Appt announcement', TextDirection.ltr);
In React Native, you can post an accessibility message by using the AccessibilityInfo
API. Use the announceForAccessibility
method to post a message to assistive technologies.
AccessibilityInfo.announceForAccessibility('Appt announcement');
Xamarin Forms does not have built-in support for changing accessibility focus.
The SemanticExtensions
file inside the Xamarin.CommunityToolkit
contains the Announce
method. It posts an accessibility announcement on the native platform.
SemanticExtensions.Announce("Appt announcement");