Search code examples
iosaccessibilityuiaccessibility

iOS Accessibility Event when user performs a left/right flick action


When VoiceOver is enabled, I'd like to find out if the user is performing the left/right flick action while a UIButton is selected.

There are few methods help you with when a specific element has received or lost focus:

  • accessibilityElementDidLoseFocus
  • accessibilityElementDidBecomeFocused

But nothing within the UIAccessibilityAction to help find if the user attempted a flick left or right.

Is there a way to find out what the user is attempting to do?


Solution

  • No. You should not attempt to override the left and right VoiceOver swipe gestures. if you need to adjust a value with swiping, consider implementing a custom control with the trait UIAccessibilityTraitAdjustable. If you need to support direct gesture interaction, adopt UIAccessibilityTraitAllowsDirectInteraction.

    Edit: To answer your question, you might be able to watch focus change, issue a screen change notification, return new children, and focus the first. Please see my comment below about why this may be undesirable.