UIAccessibility not behaving as expected--swiping right from close button does not go to header label below it

34 Views Asked by At

When I swipe right on the navigation title after it is selected upon entering the screen, voiceover goes to the close button next to it. However, when I try swiping right again, the header label is not selected. If I tap on the label, it gets selected, then swiping left goes to the close button as expected. Then swiping right goes to the header label as desired. How do I get it so swiping right on the close button goes to the header label on the first try?

Here is the relevant code:

    override dynamic func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor.Background.base1
        view.accessibilityElements = []
        layoutViews()
    }

    override dynamic func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        UIAccessibility.post(notification: .screenChanged, argument: navigationController?.navigationBar)
        view.accessibilityElements = [navigationController?.navigationBar, paymentCanceledLabel].compactMap { $0 }
    }

Thanks for any feedback.

0

There are 0 best solutions below