4

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

aniket.ghode
  • 86
  • 1
  • 9
  • I suggest to open a radar in order to inform Apple as soon as possible. I noticed the same problem with the custom actions in iOS 13: in the alarms settings, it's no longer possible to hear the "actions available" even if it's still possible to get them by swiping up and down ⟹ same thing in an app with custom actions. – XLE_22 Nov 04 '19 at 16:15
  • Thank you XLE_22, I have updated my question with my findings from the accessibility inspector. and I have checked in Notes app, and the rotor action is working properly, but when I try swipe up/ swipe down within my app, it does not highlight the links. – aniket.ghode Nov 05 '19 at 04:56
  • Can you share a sample of the code? – S.Moore Nov 07 '19 at 00:08
  • Try and install Xcode 11.2.1 because a huge problem with UITextView is solved, it may impact your situation? – XLE_22 Nov 07 '19 at 14:26
  • As @S.Moore suggested, you could share your code in order to understand your environment and find out the proper solution maybe? – XLE_22 Nov 07 '19 at 14:27
  • @aniket.ghode Did you find the solution for this, I am also facing same issue. – Akhil Shrivastav Jul 31 '20 at 15:47

2 Answers2

1

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

Noah Gao
  • 51
  • 3
  • 2
    Be aware, by turning `editable = YES` you will lose the entire iOS system link detection AND on iOS 12 regular users will not be able to tap on the links at all - even you will define them manually by attributedString! – Marek Staňa Nov 04 '20 at 13:30
1

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.

Marek Staňa
  • 522
  • 7
  • 10