From 7ec8b792eeb0008034dce7a821d9003bd7e9c65d Mon Sep 17 00:00:00 2001 From: vasavk Date: Mon, 12 Feb 2024 16:04:33 +0530 Subject: [PATCH] story:ONEAPP-6315: added accessibility --- VDS/Components/Icon/ButtonIcon/ButtonIcon.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index 19b78e6f..12e5ee70 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -306,7 +306,10 @@ open class ButtonIcon: Control { /// 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 = .image + accessibilityElements = [badgeIndicator] + //create a layoutGuide for the icon to key off of let iconLayoutGuide = UILayoutGuide() addLayoutGuide(iconLayoutGuide) @@ -473,8 +476,14 @@ open class ButtonIcon: Control { badgeIndicatorTrailingConstraint?.isActive = true } } + + /// Used to update any Accessibility properties. + open override func updateAccessibility() { + super.updateAccessibility() + setAccessibilityLabel(for: [icon, badgeIndicator.label]) + } } - + // MARK: AppleGuidelinesTouchable extension ButtonIcon: AppleGuidelinesTouchable { /// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.