Day 164

Inspect labels, traits, and actions

29 Oct 2022

With the Accessibility Inspector you can check the value for the most common accessibility attributes for individual elements, do some basic navigation, and even perform actions if the component is adjustable or if it has custom actions.

The accessibility inspector has a button that lets you select individual elements on a simulator or device. It is also possible to navigate element by element (like emulating left/right swipes with VoiceOver), automatically move through all the elements on screen, speak each element (rough VoiceOver emulation)… it is also possible to see what values the most common accessibility attributes have configured (label, value, traits, identifier, hint…). And even perform some actions: Activate, increment/decrement for adjustable components, and custom actions. A list of all the custom actions appear with a perform button next to it.

Some of you have asked me how you can support what I do. This would really help, and would be hugely appreciated:

  • Find these posts useful? Share them at work, on social media, or with anyone that might find them interesting. Let's spread the word!

  • Check out any of my apps or games: Xarra!, RetroRapid!, or Mestre!.

    • A download and a review go a long way. They're free by default. On the App Store, ratings and reviews really help more people discover them.

    • Finding any of them useful? If so, and if you can afford it, purchasing lifetime access to all features or subscribing lets me buy the coffee that keeps me caffeinated. Caffeine keeps me going to maintain the apps, bring in new features that I hope you'll love, and keep writing.

You may also find interesting...

UISliders are adjustable, and its default accessibility value is represented in percentages. But that's not always the best format to express a value. Consider a slider to select a distance radius. Miles or km seem a more appropriate unit. Example code in the image: ```swift override var accessibilityValue: String? { get { let formatter = MeasurementFormatter() let measurement = Measurement( value: Double(value), unit: .kilometers ) formatter.unitStyle = .long return formatter.string(from: measurement) } set {} } ```

There is an Environment Overrides panel in the toolbar on top of Xcode's Debug Area. It allows you to select some of the most common accessibility options and Dynamic Type sizes, like in the Accessibility Inspector, plus select dark/light mode.

The Accessibility Inspector has a Notifications log that you can find in Window, in its top menu, and then Show Notifications. It shows accessibility-related notifications like layout changed, screen changed, or announcements... I learned about this feature from the Accessibility Inspector in this article by @basthomas. A very recommended read to learn all about the Verifying VoiceOver with the Accessibility Inspector. https://www.basbroek.nl/verifying-voiceover


Content © Daniel Devesa Derksen-Staats on Accessibility up to 11! is licensed under CC BY 4.0. License details