Accessibility wip

This commit is contained in:
Justin Mazzocchi 2021-02-01 19:47:48 -08:00
parent 783a44a67e
commit 550a1acb8b
No known key found for this signature in database
GPG Key ID: E223E6937AAFB01C
3 changed files with 13 additions and 0 deletions

View File

@ -80,6 +80,7 @@
"compose-button.accessibility-label.toot" = "Compose Toot";
"emoji.custom" = "Custom";
"emoji.default-skin-tone" = "Default skin tone";
"emoji.default-skin-tone-button.accessibility-label" = "Select default skin tone";
"emoji.frequently-used" = "Frequently used";
"emoji.search" = "Search Emoji";
"emoji.system-group.smileys-and-emotion" = "Smileys & Emotion";

View File

@ -130,12 +130,16 @@ final class EmojiPickerViewController: UIViewController {
for: .normal)
skinToneButton.showsMenuAsPrimaryAction = true
skinToneButton.menu = defaultSkinToneSelectionMenu
skinToneButton.accessibilityLabel =
NSLocalizedString("emoji.default-skin-tone-button.accessibility-label", comment: "")
view.addSubview(collectionView)
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.backgroundColor = .clear
collectionView.dataSource = dataSource
collectionView.delegate = self
collectionView.isAccessibilityElement = false
collectionView.shouldGroupAccessibilityChildren = true
NSLayoutConstraint.activate([
searchBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),

View File

@ -64,6 +64,8 @@ private extension EmojiView {
emojiLabel.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor),
emojiLabel.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor)
])
setupAccessibility()
}
func applyEmojiConfiguration() {
@ -74,11 +76,17 @@ private extension EmojiView {
emojiLabel.isHidden = true
imageView.kf.setImage(with: emoji.url)
accessibilityLabel = emoji.shortcode
} else {
imageView.isHidden = true
emojiLabel.isHidden = false
emojiLabel.text = emojiConfiguration.emoji.name
accessibilityLabel = emojiConfiguration.emoji.name
}
}
func setupAccessibility() {
isAccessibilityElement = true
}
}