Can the accessibility text of a UIView be changed based on the direction the focus it received.
Example:
I have a layout as rendered below, Top Label followed by Collection view, followed by Bottom Label.
Collection view has 4 cells(for this example) and these cells have isAccessibilityElement enabled, so Voice over can read each cell’s content, not the collection view as a whole.
This collection view is basically a table with rows and columns.
When Voice Over(VO) focus is shifted (Top -> Bottom) from ‘Top label’ to ‘Cell 1’, the accessibility text of the ‘Cell 1’ should be ‘<Cell 1 content>, table, with n Rows, n Columns>’ and when focus is traversed through other cells in the collection view, it would only read the cell’s accessibility label respectively.
Query:
When the VO’s focus is shifted(Bottom -> Top) from ‘Cell 4’ to ‘Bottom Label’, can the accessibility text of cell 4’s be ‘<Cell 4 content>, table, with n Rows, n Columns>’ instead of its content.
2
Answers
The solution that worked for me is for listening for the element upon receiving the focus, storing the previous elements locally and settings the accessibility label accordingly.
Below article helped with the solution - link
Listening for the focus change. [
The accessibility text of a UIView cannot be changed based on the direction of focus it received.
There are three issues:
I recommend changing the items to be announced with a hint of "1 of 5" or "x of 5". This means when you visit the item it merely says "1", and then after a short pause it will say "1 of 5".
Here is an example that does this:
Here is a screenshot taken with the VoiceOver text box at the bottom so you can see what is spoken: