updated the accessiblity in BadgeIndicator

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-04-02 11:38:01 -05:00
parent d1a320d44b
commit 7c5d52c276

View File

@ -268,10 +268,10 @@ open class BadgeIndicator: 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
addSubview(badgeView)
badgeView.addSubview(label)
accessibilityElements = [label]
heightConstraint = badgeView.heightGreaterThanEqualTo(constant: badgeSize)
widthConstraint = badgeView.widthGreaterThanEqualTo(constant: badgeSize)
@ -347,6 +347,15 @@ open class BadgeIndicator: View {
layoutIfNeeded()
}
open override func updateAccessibility() {
super.updateAccessibility()
if kind == .numbered {
accessibilityLabel = label.text
} else {
accessibilityLabel = "Simple"
}
}
open override func layoutSubviews() {
super.layoutSubviews()