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.
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.