Reputation: 4594
I searched but could not find an up-to-date question, so here goes:
Could someone let me know what Xcodes Accessibility Label vs Hint vs Id are used for? I think it might be label and hint are used for voiced navigation and Id's are only used for automation, but not sure if that is right?
Upvotes: 4
Views: 2699
Reputation: 2135
accessibilityLabel
end-user VoiceOver for visually impaired. Should be localized when relevant.
accessibilityIdentifier
developer facing and designed to identify a view for testing and automation. Should not be localized.
accessibilityHint
additional context for accessibilityLabel
. Should be localized when relevant. Leave blank when accessibilityLabel
is descriptive enough.
Upvotes: -1
Reputation: 166
You are correct.
The 'Label' property will be used in voice over representing the element itself. If Labels are not set manually, they will be filled in at runtime based on the content of the element. IE: "Comment Delete Button"
'Hints' are also used in voice over assistance but are a more descriptive representation of the element. IE: "This button allows users to delete a comment."
'identifier' is used for automation and quick query of the UI element. IE: "CommentDeleteButton"
The Label and Hint can be localized and therefore will vary between languages while the identifier remains the same.
Upvotes: 10