diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 67bbae67..f6bb36d5 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -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,9 @@ 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() + isAccessibilityElement = true + accessibilityTraits = .staticText - accessibilityElements = [label] layer.cornerRadius = 2 addSubview(label) @@ -177,4 +179,10 @@ open class Badge: View { label.surface = surface label.isEnabled = isEnabled } + + open override func updateAccessibility() { + super.updateAccessibility() + + accessibilityLabel = text + } }