is there a way to set the accessibility focus programatically (App Store-safe)? Any help will be greatly appreciated.
Understanding Focus In most browsers, users can move focus by pressing the Tab key and the Shift + Tab keys.
Accessing the Accessibility Inspector Choose Accessibility in the Tools > Web Developer menu. Select the Accessibility tab in the Developer Tools toolbox. Right-click in the main browser window, and choose Inspect Accessibility Properties in the context menu.
A Boolean value that indicates whether the element is an accessibility element that an assistive app can access.
An Accessibility Trait allows you to choose the best description for what an element in your application does. It is important to set up these traits properly so that a user does not get confused when clicking on a “Text Field” opens the web browser. There is a lot of misleading information out there regarding traits.
To focus on element you can call.
Swift:
UIAccessibility.post(notification: .screenChanged, argument: self.myFirstView)
ObjC:
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, self.myFirstView);
Otherwise for iOS 8+ use the accessibilityElements to set element order and it will focus automatically on first element in the list
self.accessibilityElements = @[myFirstView, mySecondButton, myThirdLabel]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With