Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make utility buttons available through accessibility actions #312

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dusek
Copy link

@dusek dusek commented Apr 25, 2015

This enables using of utility button actions with VoiceOver and Switch Control.

To test with VoiceOver:

  1. Turn on VoiceOver
  2. Move VoiceOver cursor to a cell in the demo app (or any app using SWTableViewCell)
  3. Select an action (by flicking up or down with one finger anywhere on the screen)
  4. Perform the selected action (by double-tapping with one finger anywhere on the screen)

Patches donated by A11Y LTD.

dusek added 4 commits April 26, 2015 01:07
Assistive technologies like VoiceOver and Switch Control allow users to
perform "actions" on a UI element. To enable that, we implemented an
accessibility action for each utility button. The name of the action is
the same as the accessibility label of the button.

As UIAccessibilityCustomAction class needed for this is available only
on iOS 8.0, care has been taken so that it works no matter with which
SDK it was compiled and on what iOS version it is run.

The underscored methods are underscored so as to make it clear they are
not implementations of UIAccessibilityAction protocol methods, but
rather internal supporting methods.
This adds convenience accessibility methods that add accessibility
labels to the utility buttons created with an image wihtout a
title. This is important because buttons with titles automatically get
their title as accessibility label, but buttons without a title and with
an image nearly always need custom accessibility label, as the default
is the image filename stripped of filename suffix. As a matter of fact,
whenever one wants to add an image button using an image method of this
category, they should always use the accessibility version (except when
they already set the correct accessibility label on the UIImage, then it
is not strictly necessary). So best would be to deprecate the "old"
image methods that do not specify accessibility label.

Still, when other accessibility properties (like hint or value) need to
be customized (as well as non-accessibility properties), direct access
to the button after adding it to the array can be used.
Promote the accessibility methods from our array category in README.md.
Show different means of how accessibility actions for image-only utility
buttons get their names:

- by using the accessibility variant of the image methods on our
  NSMutableArray+SWUtilityButtons category

- by adding accessibility label directly to the UIImage

- by not adding any accessibility label at all (this is not desirable,
  it just shows the fallback accessibility label derived from the image
  file name)
@yakubbaev
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants