Stairways Software Icon

Stairways Software

Excellence In Software For Over Twenty Years – Only with a Mac

Adding Basic Accessibility to a Custom View

One of the things I did for Keyboard Maestro 6.4 was to improve accessibility support. There were several parts to this, but primarily it revolved around either just adding an accessibility title to any image-only buttons, or adding accessibility support to custom views.

Adding an accessibility label can be done easily in Interface Builder, and developers should simply remember to set it anytime the view doesn't have a normal title that can be read by VoiceOver. So if you have an image button, add an accessibility label.

The more challenging one is with custom views, but it simply requires responding to a set of accessibility methods. I found the documentation from Apple to be rather opaque, but eventually muddled through to get a good result (with the help of a couple diligent blind users who gave me a lot of assistance in understanding what was and wasn't working and what needed to be done.

In the case of a custom NSControl, the work needs to be done in the cell. And because Objective C does not have mix-in objects, it's a bit difficult to design a system that doesn't require a bunch of boilerplate code for each custom view. But this sample code does not attempt to solve that issue, just to answer the basic questions of what should you return from where. It is not a framework suitable for directly including in any project.

The only files of interest at the CustomeView and CustomCell files, the rest is just a basic Xcode template, with a custom view added to MainMenu.xib.

Download Sample Code

And please note, I'm new to this and by far not an expert. This appears to work, and passes the requirements of my users, but whether it is the best way of doing it, or there is more required, or less required, I don't pretend to know for sure. Hopefully it's useful.

If someone wants to take the project and put it up on github or some such place where the code is more searchable, that would be fine (let me know and I'll add a link).

Posted Wednesday, March 26, 2014. Permalink. Post a Comment.

Comments

Post Comment

Name: (optional)
URL: (optional)
Email: (optional, not published)
   
CAPTCHA: four five two three (required)
  To prove you are human, please enter the number as digits (ie, 1-9).
Comment:
  You can use some HTML tags such as <b>, <i>, and <a href="">.
We reserve the right to remove any offensive or inappropriate comments.
Due to spam issues, comments are initially invisible until we review them,
you can see them (background red) and we can see them, but no one else.

Comment Preview

None yet.

Buy Now

User Database

Stairways