Skip to main content

Posts

Showing posts from February, 2020

iOS accessibility issue - focus goes to a random position

Recently, I faced an issue where the Accessibility(ADD) control goes to random position after selecting a table section/row. On one screen where I worked, there was requirement of collapsing and expanding table header. When user tried to collapse/expand the header, the ADD control goes to random position.  Initially, I tried to post the accessibility notification to set the ADD control to specific section, but it didn't work. (Generally, In most of the cases it works) UIAccessibility.post(notification: .layoutChanged, argument: sectionInstance) Secondly, I tried to use the below method. By using this method, I get a callback when an element has ADD focus. When I get a callback, I scrolled the table to the desired position and then post notification, but sadly it didn't work too. override func accessibilityElementDidBecomeFocused() Finally, I used the default scroll method (scrollViewDidScroll) where I got the regular callbacks when table scrolls. When a section is collapsed/exp…