Skip to main content
Logo Appt Light

Success Criterion 3.3.1 - Level A

Error Identification

Ensure users receive a clear error message after entering incorrect data. Clearly indicate which entry is incorrect and why. It is important that error messages are also clear to users of assistive technologies. Therefore, also indicate errors in text to allow everyone to perceive them.

Impact

  • Filling in data correctly becomes easier for everyone when error messages are clearly indicated.

  • Clear error messages are especially important for people with cognitive, language and learning disabilities.

Check

"Are input errors indicated clearly when entering incorrect data?

This can be tested without assistive technologies.

Solution

Show errors

On Android, you can use a TextView to show an error message. The error message should also be posted to assistive technologies by using an accessibility announcement.

You can also use TextInputLayout, which makes showing error messages easier. Set setErrorEnabled to true and then set the error message by using the setError method.

textView.setVisibility(View.VISIBLE)
textView.text = "Invalid date, must be in the form DD/MM/YYYY, for example, 01/01/2000"

input.setErrorEnabled(true)
input.setError("Invalid date, must be in the form DD/MM/YYYY, for example, 01/01/2000")

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)

Resources

Feedback?

Let us know!