Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOS Accessibility, Inside & Out

Sommer Panage
December 10, 2015

iOS Accessibility, Inside & Out

A look at what Accessibility is and why you should care. Also a deep dive into the iOS Accessibility APIs. Finally, a look at what is new in iOS8.

Sommer Panage

December 10, 2015
Tweet

More Decks by Sommer Panage

Other Decks in Technology

Transcript

  1. VISION VOICEOVER ▸ UIAccessibility APIs such as accessibilityLabel ▸ Avoid

    images with text ▸ Label all images ▸ Provide equal experiences
  2. 44 minutes ago One nice thing about 2013 has been

    not having to hear Pumped Up Kicks very often. At rooland. Reply Retweet Favorite Jordan Kay At underscore Jordan Profile Picture
  3. “Jordan Kay. At Underscore Jordan. 44 minutes ago. One nice

    thing about 2013 has been not having to hear Pumped Up Kicks very often. Dash. At Roooooland. Two-finger double-tap for tweet actions.”
  4. VISION COLOR AND FONTS ▸ Always use Dynamic Type for

    everything ▸ Tap targets should be no smaller than 44x44 points ▸ All text should have a minimum contrast ratio of 4.5:1 (http:// webaim.org/resources/contrastchecker/) ▸ Keep color schemes simple ▸ Never indicate meaningful content with color alone
  5. HOW DO I SUPPORT USERS WITH HEARING, MOTOR OR OTHER

    CHALLENGES? A good developer AS A DEVELOPER…
  6. OTHER CHALLENGES CAPTIONING AND SOUND ▸ All audio/video content should

    provide optional captioning ▸ Never signal anything with sound alone ▸ Avoid background music/sound and make any background sound easy to disable
  7. OTHER CHALLENGES TOUCH AND COGNITION ▸ Avoid complex / hard

    to discover gestures ▸ Again, keep touch target sizes at/above 44x44 points ▸ Test your interface using switch control; a simple, hierarchical interface will play well with switch control ▸ Avoid screen clutter - favor navigation to clutter
  8. EXAMPLES MEDIUM — NOT GREAT ▸ Tabs aren’t labled ▸

    Swipe items behind cells are “visible” to VO ▸ Grouping of items is poor ▸ Compose items aren’t labeled ▸ Doesn’t respond to back gesture. ▸ And much more…
  9. EXAMPLES SPOTIFY — GOOD! ▸ Buttons are well labeled ▸

    Grouping of content makes sense ▸ Navigation of music control is clear ▸ Buttons provide context to their behaviors when non-obvious
  10. IOS ACCESSIBILITY BASICS UIACCESSIBILITY ▸ An extension on NSObject (in

    Swift) ▸ An category on NSObject (in ObjC) ▸ Every NSObject has accessibility properties ▸ Contains the most frequently used bits of accessibility
  11. IOS ACCESSIBILITY BASICS IS ACCESSIBILITY ELEMENT? ▸ isAccessibilityElement defaults to

    NO for everything except UIControl objects and labels/text ▸ Setting to NO tells the Accessibility system recursively look at this elements subelements to find something that is accessible.
  12. IOS ACCESSIBILITY BASICS ACCESSIBILITY LABEL ▸ Static information about a

    view ▸ A description of the view in (few) words. ▸ Defaults to the text already present (but sometimes this isn’t enough) CHRISCONNOLY REFRESH 9 MINUTES AGO
  13. IOS ACCESSIBILITY BASICS ACCESSIBILITY VALUE ▸ Dynamic information about a

    view ▸ Should never be the same as the label ▸ Should never be used to store “debug information” AIRPLANE MODE ON TRACK POSITION 1 MINUTE 17 SECONDS OF 4 MINUTES 45 SECONDS
  14. func sliderValueDidUpdate() { // Update standard UI let percentage: Int

    = lroundf(volumeSlider.value * 100) volumeSlider.accessibilityValue = "\(percentage) percent" }
  15. IOS ACCESSIBILITY BASICS ACCESSIBILITY HINT ▸ Provides additional information if

    the effect of interacting with the view is non-obvious ▸ Explains how to use costume / power-user gestures ▸ Can be disabled by users, so shouldn’t contain required content SOUND VOLUME 45 PERCENT. ADJUSTABLE. SWIPE UP OR DOWN WITH ONE FINGER TO ADJUST THE VALUE
  16. volumeSlider.accessibilityLabel = “Sound volume” volumeSlider.accessibilityHint = “Swipe up or down

    with one finger to adjust the value.” *Note! The adjustable hint is added automatically by iOS for items with the adjustable trait.
  17. IOS ACCESSIBILITY BASICS ACCESSIBILITY TRAITS ▸ Traits modify how the

    system interacts with an elements ▸ Button trait will add the word “button” to the label of your element ▸ Link trait will add the word “link” to the label of of your element ▸ Summary trait tells VO where to go when the app launches
  18. IOS ACCESSIBILITY BASICS MORE ON ACCESSIBILITY TRAITS ▸ Traits are

    a bitmask and can be combined. ▸ Modifying traits in UIControls should always be done with |= unless you explicitly want to override a behavior ▸ Some traits have corresponding actions such as UIAccessibilityTraitAdjustable.
  19. // Help profile button takes user to Safari to view

    help topics helpButton.accessibilityTraits |= UIAccessibilityTraitLink
  20. ACCESSIBILITY ACTIONS ACCESSIBILITY ACTIONS ▸ The general way you handle

    any VO specific gesture ▸ Built in iOS support means much less work and implementing a custom gesture yourself (AVOID THIS)
  21. ACCESSIBILITY ACTIONS ESCAPE GESTURE ▸ A z-shape with two fingers

    ▸ Apps with a default nav bar will go back with this gesture ▸ Modals should dismiss with this gesture ▸ Generally maps to any “BACK” or “CLOSE” or “DISMISS”
  22. ACCESSIBILITY ACTIONS MAGIC TAP GESTURE ▸ A double tap with

    two fingers ▸ In Springboard, this will play/pause music ▸ Generally maps to most common action in an App ▸ In Twitter, was configurable in settings to either offer Tweet Actions or go to Compose.
  23. ACCESSIBILITY ACTIONS MORE ACTIONS ▸ accessibilityIncrement and accessibilityDecrement for any

    object with an adjustableTrait (single finger swipe up/down) ▸ accessibilityActivate is the default double-tap action. Only need to override if you are NOT behaving as a non-VO tap would ▸ accessibilityScroll handles a 3 finger swipe to trigger scrolling (generally)
  24. BEYOND THE BASICS SPECIAL UIKIT DELEGATES ▸ UIPickerView and UIScrollView

    have specific accessibility delegates ▸ UIPickerViewAccessibilityDelegate lets you a label/hint for each item in your picker. ▸ Useful for pickers with images ▸ Useful for pickers with numbers that might need more context ▸ UIScrollViewAccessibilityDelegate let’s you control the status update as your scroll view scrolls. ▸ “Tweets 1 to 20 out of 300”
  25. BEYOND THE BASICS ▸ You can use attributed strings to

    control how VO speaks text. ▸ UIAccessibilitySpeechAttributePunctuation pronounces all punctuation (great for reading code) ▸ UIAccessibilitySpeechAttributeLanguage controls the language of VO ▸ Useful when content is tagged with language ▸ UIAccessibilitySpeechAttributePitch modulate VO’s pitch ▸ Useful to convey system action such as “post deleted” ▸ Useful to differentiate content in long strings ATTRIBUTED STRINGS
  26. BEYOND THE BASICS ▸ Call UIAccessibilityPostNotification to post announcements and

    notifications ▸ UIAccessibilityLayoutChangedNotification and UIAccessibilityScreenChangedNotification trigger the system to rebuild the Accessibility tree ▸ UIAccessibilityAnnouncementNotification let’s you make an announcement to the user without user action ▸ “Refreshing content” ▸ “Notification received” NOTIFICATIONS
  27. BEYOND THE BASICS AND THERE’S MORE! ▸ Custom Accessibility for

    non-UIView based UI (UIAccessibilityContainer is the old solution) ▸ Dig around in the headers! ▸ UIAccessibility.h ▸ UIAccessibilityConstants.h ▸ UIAccessibilityZoom.h ▸ UIAccessibilityAdditions.h ▸ UIAccessibilityIdentification.h (for automation purposes)
  28. WHAT’S NEW IN IOS ACCESSIBILITY? SIMPLIFYING THE COMPLEXITY ▸ Interfaces

    are becoming more dynamic and gesturally-driven ▸ iOS 8 marked the point at which accessibility caught up with these trends ▸ More support for custom behaviors ▸ More support for accessibility tools beyond VoiceOver (such as switch systems)
  29. WHAT’S NEW IN IOS ACCESSIBILITY? ACCESSIBILITY ACTIONS ▸ Before ▸

    When objects had gesture-based actions such as flicks or swipes, we had to create custom tap-based gestures for our users on VO ▸ After ▸ We can now wrap these actions into the accessibilityCustomActions property on a view and VO will give the user direct access
  30. ACCESSIBILITY ACTIONS EXAMPLE: REMINDERS APP BUY A SPATULA. DOUBLE-TAP TO

    EDIT DETAILS. SWIPE UP OR DOWN TO SELECT A CUSTOM ACTION.THEN DOUBLE-TAP TO ACTIVATE. BUY A SPATULA. DOUBLE-TAP TO EDIT DETAILS. ACTIONS AVAILABLE. …Or…
  31. WHAT’S NEW IN IOS ACCESSIBILITY? ACCESSIBILITY CONTAINERS ▸ Before ▸

    Making custom drawing and non-UIKit objects accessible on screen meant implementing the somewhat buggy and heavy-anded Accessibility Container Protocol ▸ After ▸ Any view can simply set an accessibilityElements array to define objects within it that should be accessible
  32. ACCESSIBILITY CONTAINERS EXAMPLE: HEALTH APP ▸ The graph is clearly

    not rendered via UIViews ▸ How do we provide information to the user about what is contained in this graph?
  33. WHAT’S NEW IN IOS ACCESSIBILITY? SWITCH CONTROL…CONTROL ▸ Before ▸

    When switch support on iOS was introduced, it depended only on accessibility already present via VO. ▸ After ▸ Using accessibilityNavigationStyle, you can now control how the focus selects elements ▸ Switches also interface with any accessibilityCustomActions you add
  34. WHAT’S NEW IN IOS ACCESSIBILITY? MORE CUSTOMIZATION BASED ON DEVICE

    STATE ▸ Before ▸ Impossible to tell what AX features were in use. ▸ After ▸ Notifications and state checking functions for when the device enters/leaves various accessibility modes such as grayscale, reduced transparency, color inversion, and more. ▸ Allows you to change the appearance of your app, if necessary, given these modes
  35. WHAT’S NEW IN IOS ACCESSIBILITY? BACKWARDS COMPATIBILITY RECOMMENDATIONS ▸ Accessibility

    Actions ▸ For pre iOS 8, you should still provide a custom gesture and a hint to help that user find said gesture ▸ Often a good solution is using accessibilityPerformMagicTap to trigger an action sheet ▸ Containers ▸ Stick to old UIAccessibilityContainer Protocol until you drop iOS 7 support