VODGroup / VoiceOverDesigner

macOS app to help design accessibility for an iOS app
117 stars 11 forks source link

Textfield trait #191

Closed akaDuality closed 1 year ago

akaDuality commented 1 year ago

UITextField and UITextView have some special hidden trait that expose them to accesiblitiy technologies. We should investigate how to repeat this behaviour.

Also, UISwitch have special toggle-button trait.

Hidden traits according to my another repository, bit mask:

19: "pickeritem",
20: "radio button",
23: "status bar item",
25: "inactive",
26: "footer",
28: "tab",
32: "visited",
35: "tap and hold, then move up and down to select index",
38: "draggable",
39: "learning",
40: "pop-up button",
42: "maths",
45: "hide from focus",
50: "folder",
52: "menu item",
53: "double tap to toggle settings",
59: "video playback",
60: "icon",
drucelweisse commented 1 year ago

From this gist:

static UIAccessibilityTraits UIAccessibilityTraitTextEntry = 0x0000000000040000;
static UIAccessibilityTraits UIAccessibilityTraitIsEditing = 0x0000000000200000;

Which means in Swift it will be:

static let textFieldEntry = UIAccessibility(rawValue: 262144)
static let isEditingEntry = UIAccessibility(rawValue: 2097152)

Checked in sumulator example and it magically works!

https://user-images.githubusercontent.com/36012972/211389453-ac625db7-4736-4328-854a-e639846c7892.MP4

akaDuality commented 1 year ago

Cool! UISwitch should be 53 number