updated accessibility

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-04-24 15:31:08 -05:00
parent 324601d490
commit 6a8285d8b1

View File

@ -364,7 +364,6 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
open override func setup() {
super.setup()
isAccessibilityElement = false
accessibilityElements = [icon, badgeIndicator]
//create a layoutGuide for the icon to key off of
let iconLayoutGuide = UILayoutGuide()
@ -459,6 +458,18 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
setNeedsLayout()
}
open override func updateAccessibility() {
super.updateAccessibility()
var elements = [Any]()
if iconName != nil {
elements.append(icon)
}
if badgeIndicatorModel != nil {
elements.append(badgeIndicator)
}
accessibilityElements = elements.count > 0 ? elements : nil
}
open override func layoutSubviews() {
super.layoutSubviews()