story:ONEAPP-6315: added accessibility

This commit is contained in:
vasavk 2024-02-12 16:04:33 +05:30
parent ff5f7e5f55
commit 7ec8b792ee

View File

@ -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. /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = true
accessibilityTraits = .image
accessibilityElements = [badgeIndicator]
//create a layoutGuide for the icon to key off of //create a layoutGuide for the icon to key off of
let iconLayoutGuide = UILayoutGuide() let iconLayoutGuide = UILayoutGuide()
addLayoutGuide(iconLayoutGuide) addLayoutGuide(iconLayoutGuide)
@ -473,8 +476,14 @@ open class ButtonIcon: Control {
badgeIndicatorTrailingConstraint?.isActive = true badgeIndicatorTrailingConstraint?.isActive = true
} }
} }
/// Used to update any Accessibility properties.
open override func updateAccessibility() {
super.updateAccessibility()
setAccessibilityLabel(for: [icon, badgeIndicator.label])
}
} }
// MARK: AppleGuidelinesTouchable // MARK: AppleGuidelinesTouchable
extension ButtonIcon: AppleGuidelinesTouchable { extension ButtonIcon: AppleGuidelinesTouchable {
/// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea. /// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.