iOS 13 Voiceover issue, rotor action not working with embedded links

1.3k Views Asked by At

We have implemented the voiceover functionality in our app for the custom alert view which contains the UITextView. This UITextView has the links and we have also added the correct LinkAttributes for the links.

in iOS 12 its working fine, using rotor (vertical swipe) to highlight the links, but its not working in iOS 13. I checked a lot in the documentation and have spent 48 hours on this to find the root cause but no success.

I was debugging my app with Accessibility Inspector and when I Ran Audit, it suggests that subviews of UITextView are not accessible, "Potentially inaccessible text: The element appears to display text that should be implemented using the accessibility API.".

Has anyone else faced this issue and have the solution for this problem.

Thanks in Advance

2

There are 2 best solutions below

0
On

Sample code of the problem:

class ViewController: UIViewController {
    @IBOutlet weak var textView: UITextView!

    override func viewDidLoad() {
        super.viewDidLoad()

        textView.isSelectable = true
        textView.dataDetectorTypes = .all

        let attributedString = NSMutableAttributedString(string: "Want to visit facebook?Want to visit google?")
        attributedString.addAttribute(.link, value: URL(string: "https://www.google.com")!, range: NSRange(location: 14, length: 8))
        attributedString.addAttribute(.link, value: URL(string: "https://www.facebook.com")!, range: NSRange(location: 36, length: 6))
        textView.attributedText = attributedString
    }
}

I would point out that this is an iOS 13 issue. iOS 12 works as expected. The workaround suggested with editable = YES and handling textViewShouldBeginEditing: works for VoiceOver which fixes bug we are speaking about but the next problem is Voice Control + show numbers feature - with this workaround the numbers for links are not working properly.

1
On

Recently, I faced this issue

before iOS13, UITextView voice over should set editable = NO, using rotor (vertical swipe) to highlight the links, it works fine

But after iOS13, you should set editable = YES, using UITextViewDelegate textViewShouldBeginEditing: func to disable keyBoard.

I think it is a bug for Voice Over

By the way, UITextView detect link is not fluently, you can using UILabel with custom accessibility elements to handle the situation