Uisearching for Accessibility = nil

Picture showing an iOS 7 and up search bar.As I am sure you can tell, This post in more about the accessibility of developing apps for iOS. While this post may be quite technical, I think that all users can learn from what is said here.

While building an app, I found out that some of the code I was using was what is called depreciated by Apple. This means that the code has been replaced with something newer and hopefully cooler, and this is the case with adding a search bar to an app. The trouble is, all of the tutorials I have found on how to do this are giving bad information, and the developers that use these tutorials are making apps with inaccessible search result tables. Read on if you are still interested in learning why this is, and how to fix it.

What is the problem?

When a developer makes a search results table from what is called a UISearchController they are given two options. To make the current table display search results, or have another table display the search results. Which one sounds the easiest.

If you said the first where the table that already presents data acts as the search results table view would be the easiest then you would be correct, but VoiceOver sees the search Bar as being in focus and ignores the table in the background, which does not allow for VoiceOver users to check view website and see search results. visual users not using VoiceOver have no issue here, but VoiceOver will not be able to give the user feedback or allow the person to select a result.

What is the solution?

The solution is option 2 for adding search. Simply add another table view controller that mirrors your table that is to be searched and tell the UISearchController that that table controller is the one responsible for displaying search results. You will have to add methods for handling row selection and displaying of data from the presenting table, but you are already doing this to display your current data.

Conclusion

While this may take a few extra steps of work while building your app it will be worth it to make sure your customers can search through your data as any other iOS user would. I would advise developers to use option 2.

Leave a Reply