updated accessibility

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-09-21 14:54:44 -05:00
parent 81733bdc1f
commit 886577e945

View File

@ -47,6 +47,7 @@ open class Badge: View {
//--------------------------------------------------
/// Label used to render text
open var label = Label().with {
$0.isAccessibilityElement = false
$0.lineBreakMode = .byTruncatingTail
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
@ -131,8 +132,7 @@ open class Badge: View {
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() {
super.setup()
accessibilityElements = [label]
isAccessibilityElement = true
layer.cornerRadius = 2
addSubview(label)
@ -177,4 +177,10 @@ open class Badge: View {
label.surface = surface
label.isEnabled = isEnabled
}
open override func updateAccessibility() {
super.updateAccessibility()
accessibilityLabel = text
}
}