I have some content that is not accessible to Talkback user (Google Map view). Is it better to hide this view when Talkback is on or it is better to just mark android:importantForAccessibility="no"?
2 Answers
This is how we handle it:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAccessibility="noHideDescendants">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/store_map"
android:name="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
I want to make an update based on super excited @ChrisCM's response. We have the same content in the map contained in a list right below the map so the user is still able to achieve the same outcome.

- 8,197
- 7
- 35
- 50

- 7,075
- 9
- 44
- 89
-
1Thank you for the reply. We actually also have a similar list that duplicates the map content. I will do the same then. – Julia F Jan 20 '18 at 16:11
-
@JuliaF - can you please accept it if it was helpful :) – dazza5000 Jan 22 '18 at 01:00
- It's best to make it accessible. You should be able to override any developers crappy accessibility practices by overriding the accessibility delegate of the root of the view hierarchy that is inaccessible. This allows you to make the view of any third party library view hierarchy in your app accessible, by overriding it's accessibility hierarchy and creating your own virtual accessibility layer on top of it. This approach will work for any view whose concept isn't fundamentally inaccessible, like a piano app, drawing app, or first person shooter game... or something like that.
- If the above isn't an option (it's always an option), but if for some hypothetical reason it isn't, at the very least DO NOT utilize the
noHideDescendants
method. It ultimately doesn't accomplish anything... actually, it only serves to HIDE what elements of a view may actually be accessible.
What noHideDescendants
does is just virtually hide the view and all its children from assistive technologies. What's the purpose of hiding something, that isn't accessible?
- If it's not accessible, that generally means that there's nothing to hide.
- If you've successfully caused TalkBack to NOT focus something, you've hidden something that is useful. Perhaps not SUPER informative, but still, anything that would have been focused without your intrusion, is something that would have presented SOME type of information to the user or allowed some type of interaction.
Even if it's just reading out the name of a gif for an image or something strange, that's often better than nothing. Particularly when you consider that blind users are not the only users of TalkBack. Partially sighted users use TalkBack as well. Even if there is no information on a control, TalkBack will still allow active things to be focusable. By utilizing "noHideDescendants" you can only make things worse. If you're emberassed by TalkBack reading out
blah_blah.jpeg, button, double tap to....
Well, then see solution 1... and don't be lazy! :)

- 18,425
- 3
- 49
- 76
-
-
To hice some views from the accessibility is just as important. For example if you have an app with a lot of ads, then you can just hide them just like the question says android:importantForAccessibility="no" – Jose Gonzalez Jan 25 '23 at 16:04
-
But, that's hiding content from the user... this is wrong and technically speaking something you can get sued for in certain industries. – MobA11y Aug 08 '23 at 13:55