diff --git a/Rocket.Chat/External/RCEmojiKit/Views/EmojiPicker/EmojiCollectionViewCell.swift b/Rocket.Chat/External/RCEmojiKit/Views/EmojiPicker/EmojiCollectionViewCell.swift
index a3732175c2..04c895c292 100644
--- a/Rocket.Chat/External/RCEmojiKit/Views/EmojiPicker/EmojiCollectionViewCell.swift
+++ b/Rocket.Chat/External/RCEmojiKit/Views/EmojiPicker/EmojiCollectionViewCell.swift
@@ -44,9 +44,13 @@ final class EmojiCollectionViewCell: UICollectionViewCell {
guard let url = url else { return }
ImageManager.loadImage(with: url, into: emojiImageView)
emojiImageView.isHidden = false
+ emojiImageView.isAccessibilityElement = true
+ emojiLabel.accessibilityElementsHidden = true
case .standard(let string):
emojiLabel.text = string
+ emojiImageView.accessibilityLabel = string
emojiLabel.isHidden = false
+ emojiLabel.accessibilityElementsHidden = false
}
}
}
diff --git a/Rocket.Chat/External/RCEmojiKit/Views/EmojiPicker/EmojiPicker.swift b/Rocket.Chat/External/RCEmojiKit/Views/EmojiPicker/EmojiPicker.swift
index dc5b677978..ec01f3fd1d 100644
--- a/Rocket.Chat/External/RCEmojiKit/Views/EmojiPicker/EmojiPicker.swift
+++ b/Rocket.Chat/External/RCEmojiKit/Views/EmojiPicker/EmojiPicker.swift
@@ -93,13 +93,13 @@ final class EmojiPicker: UIView, RCEmojiKitLocalizable {
@IBOutlet weak var emojisCollectionView: UICollectionView!
- let skinTones: [(name: String?, color: UIColor)] = [
- (name: nil, color: #colorLiteral(red: 0.999120295, green: 0.8114234805, blue: 0.06628075987, alpha: 1)),
- (name: "tone1", color: #colorLiteral(red: 0.982526958, green: 0.8808286786, blue: 0.7670835853, alpha: 1)),
- (name: "tone2", color: #colorLiteral(red: 0.8934452534, green: 0.7645885944, blue: 0.6247871518, alpha: 1)),
- (name: "tone3", color: #colorLiteral(red: 0.7776196599, green: 0.6034522057, blue: 0.4516467452, alpha: 1)),
- (name: "tone4", color: #colorLiteral(red: 0.6469842792, green: 0.4368215203, blue: 0.272474587, alpha: 1)),
- (name: "tone5", color: #colorLiteral(red: 0.391161263, green: 0.3079459369, blue: 0.2550256848, alpha: 1))
+ let skinTones: [(name: String?, color: UIColor, accessibilityName: String)] = [
+ (name: nil, color: #colorLiteral(red: 0.999120295, green: 0.8114234805, blue: 0.06628075987, alpha: 1), "skinTone.default"),
+ (name: "tone1", color: #colorLiteral(red: 0.982526958, green: 0.8808286786, blue: 0.7670835853, alpha: 1), "skinTone.tone1"),
+ (name: "tone2", color: #colorLiteral(red: 0.8934452534, green: 0.7645885944, blue: 0.6247871518, alpha: 1), "skinTone.tone2"),
+ (name: "tone3", color: #colorLiteral(red: 0.7776196599, green: 0.6034522057, blue: 0.4516467452, alpha: 1), "skinTone.tone3"),
+ (name: "tone4", color: #colorLiteral(red: 0.6469842792, green: 0.4368215203, blue: 0.272474587, alpha: 1), "skinTone.tone4"),
+ (name: "tone5", color: #colorLiteral(red: 0.391161263, green: 0.3079459369, blue: 0.2550256848, alpha: 1), "skinTone.tone5")
]
var currentSkinToneIndex: Int {
@@ -112,7 +112,7 @@ final class EmojiPicker: UIView, RCEmojiKitLocalizable {
}
}
- var currentSkinTone: (name: String?, color: UIColor) {
+ var currentSkinTone: (name: String?, color: UIColor, accessibilityName: String) {
return skinTones[currentSkinToneIndex]
}
@@ -121,6 +121,9 @@ final class EmojiPicker: UIView, RCEmojiKitLocalizable {
skinToneButton.layer.cornerRadius = skinToneButton.frame.width/2
skinToneButton.backgroundColor = currentSkinTone.color
skinToneButton.showsTouchWhenHighlighted = true
+ skinToneButton.accessibilityLabel =
+ localized("skinTone.label") + localized("currentSkinTone.label")
+ skinToneButton.accessibilityValue = localized(currentSkinTone.accessibilityName)
}
}
@@ -128,6 +131,7 @@ final class EmojiPicker: UIView, RCEmojiKitLocalizable {
currentSkinToneIndex += 1
currentSkinToneIndex = currentSkinToneIndex % skinTones.count
skinToneButton.backgroundColor = currentSkinTone.color
+ skinToneButton.accessibilityValue = localized(currentSkinTone.accessibilityName)
emojisCollectionView.reloadData()
}
@@ -180,6 +184,8 @@ final class EmojiPicker: UIView, RCEmojiKitLocalizable {
let categoryItems = currentCategories.map { category -> UITabBarItem in
let image = UIImage(named: category.name) ?? UIImage(named: "custom")
let item = UITabBarItem(title: nil, image: image, selectedImage: image)
+ item.isAccessibilityElement = true
+ item.accessibilityLabel = category.name
item.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -6, right: 0)
return item
}
@@ -215,6 +221,7 @@ extension EmojiPicker: UICollectionViewDataSource {
) as? EmojiPickerSectionHeaderView else { return UICollectionReusableView() }
headerView.textLabel.text = localized("categories.\(currentCategories[indexPath.section].name)")
+ headerView.textLabel.accessibilityTraits = .header
return headerView
}
@@ -230,6 +237,8 @@ extension EmojiPicker: UICollectionViewDataSource {
if let file = emoji.imageUrl {
cell.emoji = .custom(URL(string: file))
+ cell.emojiImageView.accessibilityLabel = emoji.name
+ cell.emojiImageView.accessibilityTraits = .staticText
} else {
var toneModifier = ""
if emoji.supportsTones, let currentTone = currentSkinTone.name { toneModifier = "_\(currentTone)" }
diff --git a/Rocket.Chat/External/RCEmojiKit/Views/EmojiView.xib b/Rocket.Chat/External/RCEmojiKit/Views/EmojiView.xib
index a131891aca..fd15b647e3 100644
--- a/Rocket.Chat/External/RCEmojiKit/Views/EmojiView.xib
+++ b/Rocket.Chat/External/RCEmojiKit/Views/EmojiView.xib
@@ -25,6 +25,10 @@
+
+
+
+