From 7c5d52c276acce69ddd452d7aa895ea6bccc3be9 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 2 Apr 2024 11:38:01 -0500 Subject: [PATCH] updated the accessiblity in BadgeIndicator Signed-off-by: Matt Bruce --- VDS/Components/BadgeIndicator/BadgeIndicator.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/VDS/Components/BadgeIndicator/BadgeIndicator.swift b/VDS/Components/BadgeIndicator/BadgeIndicator.swift index 45432458..f9d18301 100644 --- a/VDS/Components/BadgeIndicator/BadgeIndicator.swift +++ b/VDS/Components/BadgeIndicator/BadgeIndicator.swift @@ -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()