Cell shifts under VoiceOver when accessibility APIs are overridden
If you subclass UITableViewCell and override the accessibility APIs, accessibilityElementCount, accessibilityElementAtIndex:, and indexOfAccessibilityElement:, and have cell contents that extend into the rightward 30 point of the content view, and then turn VoiceOver on and swipe through the accessible items, the content view of each cell scrolls over 30 points to the left when you swipe.
Steps to reproduce:
- Clone https://github.com/apontious/VoiceOver-UITableViewCell-Bug.git
- Build and run project "1. VoiceOver Problem" on an iPhone or iPod touch with VoiceOver turned on.
- Note that for custom MyCell class, accessibility APIs accessibilityElementCount, accessibilityElementAtIndex:, and indexOfAccessibilityElement: have been overridden.
- Double-tap the + button a few times to create a few table cells
- Swipe to the right to navigate through the contents of the cells
UI stays stationary, only VoiceOver selection changes.
The entire content view of the cell is scrolled over 30 points to the left.
Happens on iPod touch and iPhone with VoiceOver turned on.
iOS 7.0.*. I've heard it may also happen on iOS 6, but don't have a device running 6 to test it on.
accessible items, the content view of each cell scrolls over 30 points to the left when you swipe.
The additional project "2. Hack Solution" shows that this can be hacked to work by overriding the cell's scrollViewDidScroll: and setting the scroll view's scrollOffset back to 0, 0. This works because UITableViewCell is the delegate for its parent scroll view class.
Project "3. Resize Solution" shows that the problem doesn't occur if no contents extend into the last rightward 30 points of the cell's content view.
Project "4. No Accessibility APIs Solution" shows that if you *don't* override the accessibility APIs, this also doesn't happen. Weird, eh?
Reports posted here will not necessarily be seen by Apple.
All problems should be submitted at bugreport.apple.com before they are posted here.
Please only post information for Radars that you have filed yourself, and please do
not include Apple confidential information in your posts. Thank you!