Creating Accessibility Elements for Links in UITextView
Creating Accessibility Elements for Links in UITextView
- Subject: Creating Accessibility Elements for Links in UITextView
- From: Kenny Carruthers <email@hidden>
- Date: Sun, 22 Nov 2015 23:48:07 +0700
Hello,
I have a block of text that I need to show to the user in an iOS app. The requirements are as follows:
- Links must be detected
- Each link must be recognized as a VoiceOver element
- Each paragraph must be recognized as a VoiceOver element.
Is there a way to configure UITextView (or UILabel for that matter) to satisfy all these requirements? An attributed string is used as the text. (Which was read from an RTF document.)
Obviously, getting link detection to work is straight forward, but the links are not detected by VoiceOver. And if multiple paragraphs are present, then they are not broken up by VoiceOver either. Using a WebView almost works, but it we're not particularly interested in using HTML for everything.
One attempt was to create a new UILabel subclass for every paragraph in the text and lay them out using a stack view. This works fine and satisfies the third requirement. With some custom code I can also detect links and touches in a UILabel subclass and that works as well. However, when I attempt create accessibility elements I run into some problems.
(This is in a UILabel subclass). I convert the label to be an accessibility container by returning "NO" to "isAccessibilityElement". I then create two accessibility elements: one for the label itself and a second one for the link. That appears to work, but it suffers from one big problem: VoiceOver does not recognize the custom accessibility elements until after the user has clicked on the label. (So in a few with 5 labels laid out top to bottom, VoiceOver does not see any accessibility elements until you tap on them, after which it sees each element you've tapped on.)
My guess is that hijacking a UILabel's accessibility elements might not be supported (or I'm doing it wrong). Regardless, any thoughts as to how to go about satisfying the requirements above?
Thank you,
Kenny
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden