added logic for added/removing the accessibilityTrait .notEnabled based off the dissbled state

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-07-17 13:38:36 -05:00
parent 1b292531ed
commit bc6c783e4e
7 changed files with 33 additions and 7 deletions

View File

@ -270,6 +270,11 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
}
open override func updateAccessibilityLabel() {
if !accessibilityTraits.contains(.notEnabled) && disabled {
accessibilityTraits.insert(.notEnabled)
} else {
accessibilityTraits.remove(.notEnabled)
}
setAccessibilityLabel(for: [label, childLabel, errorLabel])
}
}

View File

@ -138,7 +138,6 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
}
open func setup() {
translatesAutoresizingMaskIntoConstraints = false
titleLabel?.adjustsFontSizeToFitWidth = false
@ -172,7 +171,11 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
}
open func updateAccessibilityLabel() {
if !accessibilityTraits.contains(.notEnabled) && disabled {
accessibilityTraits.insert(.notEnabled)
} else {
accessibilityTraits.remove(.notEnabled)
}
}
//--------------------------------------------------

View File

@ -76,6 +76,7 @@ open class TextLinkCaret: ButtonBase {
//--------------------------------------------------
open override func setup() {
super.setup()
accessibilityTraits = .link
}
open override func reset() {

View File

@ -248,6 +248,11 @@ open class RadioBoxItem: Control, Changeable {
}
open override func updateAccessibilityLabel() {
if !accessibilityTraits.contains(.notEnabled) && disabled {
accessibilityTraits.insert(.notEnabled)
} else {
accessibilityTraits.remove(.notEnabled)
}
setAccessibilityLabel(for: [textLabel, subTextLabel, subTextRightLabel])
}

View File

@ -182,7 +182,6 @@ open class EntryField: Control, Changeable {
super.setup()
isAccessibilityElement = true
accessibilityTraits = .button
addSubview(stackView)
//create the wrapping view

View File

@ -312,6 +312,11 @@ open class Toggle: Control, Changeable {
}
open override func updateAccessibilityLabel() {
if !accessibilityTraits.contains(.notEnabled) && disabled {
accessibilityTraits.insert(.notEnabled)
} else {
accessibilityTraits.remove(.notEnabled)
}
setAccessibilityLabel(for: [label])
}
}

View File

@ -53,9 +53,9 @@ open class Tooltip: Control, TooltipLaunchable {
open var title: String? { didSet { setNeedsUpdate() }}
open var content: String? { didSet { setNeedsUpdate() }}
open var contentView: UIView? { didSet { setNeedsUpdate() }}
//--------------------------------------------------
// MARK: - Configuration
//--------------------------------------------------
@ -87,7 +87,7 @@ open class Tooltip: Control, TooltipLaunchable {
$0.setSurfaceColors(VDSColor.elementsBrandhighlight, VDSColor.elementsBrandhighlight, forState: .normal)
$0.setSurfaceColors(VDSColor.elementsBrandhighlight, VDSColor.elementsBrandhighlight, forState: .highlighted)
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
}
}
//--------------------------------------------------
// MARK: - Initializers
@ -163,6 +163,14 @@ open class Tooltip: Control, TooltipLaunchable {
//get the color for the image
let imageColor = iconColorConfiguration.getColor(self)
imageView.image = infoImage.withTintColor(imageColor)
}
open override func updateAccessibilityLabel() {
if !accessibilityTraits.contains(.notEnabled) && disabled {
accessibilityTraits.insert(.notEnabled)
} else {
accessibilityTraits.remove(.notEnabled)
}
var label = title
if label == nil {
label = content
@ -171,9 +179,9 @@ open class Tooltip: Control, TooltipLaunchable {
accessibilityLabel = "Tooltip: \(label)"
}
}
}
// MARK: AppleGuidlinesTouchable
extension Tooltip: AppleGuidlinesTouchable {