ONEAPP-5106 - Accessibility iOS Icon

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-09-19 11:03:36 -05:00
parent 7df4f0cdf9
commit 1319d19359

View File

@ -44,6 +44,7 @@ open class Icon: View {
//-------------------------------------------------- //--------------------------------------------------
/// UIImageView used to render the icon. /// UIImageView used to render the icon.
open var imageView = UIImageView().with { open var imageView = UIImageView().with {
$0.isAccessibilityElement = false
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
$0.contentMode = .scaleAspectFill $0.contentMode = .scaleAspectFill
$0.clipsToBounds = true $0.clipsToBounds = true
@ -78,7 +79,7 @@ open class Icon: View {
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() { open override func setup() {
super.setup() super.setup()
setContentCompressionResistancePriority(.required, for: .vertical) setContentCompressionResistancePriority(.required, for: .vertical)
setContentHuggingPriority(.required, for: .vertical) setContentHuggingPriority(.required, for: .vertical)
setContentCompressionResistancePriority(.required, for: .horizontal) setContentCompressionResistancePriority(.required, for: .horizontal)
@ -123,6 +124,11 @@ open class Icon: View {
color = VDSColor.paletteBlack color = VDSColor.paletteBlack
imageView.image = nil imageView.image = nil
} }
open override func updateAccessibility() {
super.updateAccessibility()
accessibilityLabel = name?.rawValue ?? "icon"
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Private Methods // MARK: - Private Methods