Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS change accessibility focus.

is there a way to set the accessibility focus programatically (App Store-safe)? Any help will be greatly appreciated.

like image 489
John S Avatar asked Sep 23 '11 13:09

John S


People also ask

How do you change the focus on accessibility?

Understanding Focus In most browsers, users can move focus by pressing the Tab key and the Shift + Tab keys.

How do you use an accessibility inspector?

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.

What is Isaccessibilityelement?

A Boolean value that indicates whether the element is an accessibility element that an assistive app can access.

What is Accessibilitytraits?

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.


1 Answers

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] 
like image 110
Vlad Avatar answered Oct 03 '22 23:10

Vlad