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"; "compose-button.accessibility-label.toot" = "Compose Toot";
"emoji.custom" = "Custom"; "emoji.custom" = "Custom";
"emoji.default-skin-tone" = "Default skin tone"; "emoji.default-skin-tone" = "Default skin tone";
"emoji.default-skin-tone-button.accessibility-label" = "Select default skin tone";
"emoji.frequently-used" = "Frequently used"; "emoji.frequently-used" = "Frequently used";
"emoji.search" = "Search Emoji"; "emoji.search" = "Search Emoji";
"emoji.system-group.smileys-and-emotion" = "Smileys & Emotion"; "emoji.system-group.smileys-and-emotion" = "Smileys & Emotion";

View file

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

View file

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