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:
parent
1b292531ed
commit
bc6c783e4e
@ -270,6 +270,11 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
open override func updateAccessibilityLabel() {
|
open override func updateAccessibilityLabel() {
|
||||||
|
if !accessibilityTraits.contains(.notEnabled) && disabled {
|
||||||
|
accessibilityTraits.insert(.notEnabled)
|
||||||
|
} else {
|
||||||
|
accessibilityTraits.remove(.notEnabled)
|
||||||
|
}
|
||||||
setAccessibilityLabel(for: [label, childLabel, errorLabel])
|
setAccessibilityLabel(for: [label, childLabel, errorLabel])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,7 +138,6 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func setup() {
|
open func setup() {
|
||||||
|
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
titleLabel?.adjustsFontSizeToFitWidth = false
|
titleLabel?.adjustsFontSizeToFitWidth = false
|
||||||
@ -172,7 +171,11 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func updateAccessibilityLabel() {
|
open func updateAccessibilityLabel() {
|
||||||
|
if !accessibilityTraits.contains(.notEnabled) && disabled {
|
||||||
|
accessibilityTraits.insert(.notEnabled)
|
||||||
|
} else {
|
||||||
|
accessibilityTraits.remove(.notEnabled)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -76,6 +76,7 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
accessibilityTraits = .link
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
|
|||||||
@ -248,6 +248,11 @@ open class RadioBoxItem: Control, Changeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open override func updateAccessibilityLabel() {
|
open override func updateAccessibilityLabel() {
|
||||||
|
if !accessibilityTraits.contains(.notEnabled) && disabled {
|
||||||
|
accessibilityTraits.insert(.notEnabled)
|
||||||
|
} else {
|
||||||
|
accessibilityTraits.remove(.notEnabled)
|
||||||
|
}
|
||||||
setAccessibilityLabel(for: [textLabel, subTextLabel, subTextRightLabel])
|
setAccessibilityLabel(for: [textLabel, subTextLabel, subTextRightLabel])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -182,7 +182,6 @@ open class EntryField: Control, Changeable {
|
|||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .button
|
|
||||||
addSubview(stackView)
|
addSubview(stackView)
|
||||||
|
|
||||||
//create the wrapping view
|
//create the wrapping view
|
||||||
|
|||||||
@ -312,6 +312,11 @@ open class Toggle: Control, Changeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open override func updateAccessibilityLabel() {
|
open override func updateAccessibilityLabel() {
|
||||||
|
if !accessibilityTraits.contains(.notEnabled) && disabled {
|
||||||
|
accessibilityTraits.insert(.notEnabled)
|
||||||
|
} else {
|
||||||
|
accessibilityTraits.remove(.notEnabled)
|
||||||
|
}
|
||||||
setAccessibilityLabel(for: [label])
|
setAccessibilityLabel(for: [label])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,9 +53,9 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
open var title: String? { didSet { setNeedsUpdate() }}
|
open var title: String? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var content: String? { didSet { setNeedsUpdate() }}
|
open var content: String? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var contentView: UIView? { didSet { setNeedsUpdate() }}
|
open var contentView: UIView? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration
|
// 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: .normal)
|
||||||
$0.setSurfaceColors(VDSColor.elementsBrandhighlight, VDSColor.elementsBrandhighlight, forState: .highlighted)
|
$0.setSurfaceColors(VDSColor.elementsBrandhighlight, VDSColor.elementsBrandhighlight, forState: .highlighted)
|
||||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
@ -163,6 +163,14 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
//get the color for the image
|
//get the color for the image
|
||||||
let imageColor = iconColorConfiguration.getColor(self)
|
let imageColor = iconColorConfiguration.getColor(self)
|
||||||
imageView.image = infoImage.withTintColor(imageColor)
|
imageView.image = infoImage.withTintColor(imageColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func updateAccessibilityLabel() {
|
||||||
|
if !accessibilityTraits.contains(.notEnabled) && disabled {
|
||||||
|
accessibilityTraits.insert(.notEnabled)
|
||||||
|
} else {
|
||||||
|
accessibilityTraits.remove(.notEnabled)
|
||||||
|
}
|
||||||
var label = title
|
var label = title
|
||||||
if label == nil {
|
if label == nil {
|
||||||
label = content
|
label = content
|
||||||
@ -171,9 +179,9 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
accessibilityLabel = "Tooltip: \(label)"
|
accessibilityLabel = "Tooltip: \(label)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: AppleGuidlinesTouchable
|
// MARK: AppleGuidlinesTouchable
|
||||||
extension Tooltip: AppleGuidlinesTouchable {
|
extension Tooltip: AppleGuidlinesTouchable {
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user