I can see importantForA11y is for minSdk=6+
But why would one have to use it, if they can just use setConentDescription=@null?
What is the difference between importantForA11y=false vs. setConentDescription=@null vs. focusable=false
I can see importantForA11y is for minSdk=6+
But why would one have to use it, if they can just use setConentDescription=@null?
What is the difference between importantForA11y=false vs. setConentDescription=@null vs. focusable=false
Copyright © 2021 Jogjafile Inc.
ImportantForAccessibility=falseis used to hide any element from the accessibility tree, including buttons, content etc.contentDescription=nullis only useful for things like images (there may be other items I can't think of) that you want to hide as otherwise the Accessibility Tree will do it's best to find a suitable name for an item.A prime example would be an
ImageButton- if you usecontentDescription=nullthen it will announce 'button' and the destination / button text. If you useImportantForAccessibility=falseit would hide that item completely from the accessibility tree.The best analogy I can come up with (if you are familiar with Web Standards) is that
contentDescriptionis like analtattribute oraria-labelledbyattribute andImportantForAccessibility=falseis similar toaria-hidden="true".With regards to
focusable=false, this should be used for things likeImageViews, it should always be used in conjunction withimportantForAccessibility=false(orimportantForAccessibility="no") to ensure an item that is purely decorative is completely removed from the accessibility tree.There are probably some edge cases I can't think of so above all, test it with
TalkBackor a similar screen reader.