Invert VoiceOver swipe direction in a `UICollectionView`

Hello!

I am working on an application with a chat feature. The chat is implemented using a UICollectionView. The content in our chat grows from the bottom and upwards, as is standard (like for instance the Messages app), with the most recent item being shown at the bottom.

We have implemented this using a "hack", flipping the collection view upside-down by using a transform, and flipping the content views of the cells upside down again. This works nicely; the only remaining problem is ensuring that elements are read in the correct order for users with VoiceOver enabled.

Standard behaviour with VoiceOver enabled for collection views is that swiping right moves focus to the next element, while swiping left moves focus to the previous element. Despite the collectionView being inverted (upside-down) swiping right with VoiceOver enabled moves focus to the element above, while swiping left moves focus to the element below. Is there any way to invert this behaviour?

I have looked at subclassing the collection view and overriding accessibilityIncrement and accessibilityDecrement, but it did not have any effect. It seems the standard collection view accessibility container implementation does not call these methods.

Flipping the view and flipping content inside your view may achieve the effect you're after but is not something I would necessarily recommend as it may have side effects like what you are noticing. This also may play into issues with other assistive technologies, other focus systems like keyboard navigation, etc. I encourage you to continue searching for other approaches to a solution.

The APIs for accessibilityIncrement and accessibilityDecrement are called when performing gestures on a view that has the adjustable UIAccessibilityTrait, so it's not quite what you're looking for.

You are able to manually override the property accessibilityElements on a view, and the order in which you specify the elements is the order in which VoiceOver, Switch Control, Full Keyboard Access, etc will navigate items.

https://developer.apple.com/documentation/objectivec/nsobject/1615147-accessibilityelements

Invert VoiceOver swipe direction in a `UICollectionView`
 
 
Q