Success Criterion 2.4.4 - Level A
Link Purpose (In Context)
Ensure links are clear without the surrounding content. Users of assistive technologies can request an overview of all links on the screen. It is important that the purpose of each link is clear. A common mistake is to name a link 'here'. Without the surrounding text it is not clear what you will read more about.
Assistive technologies can show an overview of all links on the screen. The purpose of each link should be clear immediately.
“Is the purpose of each link clear?“
This can be tested without assistive technologies.
On Android, links should be embedded inside an
To create text links, you can show the
span in using the
setText method of
TextView. To support assistive technologies on lower version of Android, you need to call the
The helper method
ViewCompat.addLinks() is also useful to automatically create accessible links.
Warning: you have to remove the
android:autoLink attribute from your XML to make your
val textView = TextView(this) val url = "https://appt.org" val link = "Appt" val spannableString = SpannableString("Learn more about $link") val index = spannableString.indexOf(link) spannableString.setSpan(URLSpan(url), index, index + link.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) textView.text = spannableString textView.movementMethod = LinkMovementMethod.getInstance() ViewCompat.enableAccessibleClickableSpanSupport(textView)