Merge branch 'feature/accessibilityUpdate' into 'develop'

removed accessibility protocols

See merge request BPHV_MIPS/vds_ios!46
This commit is contained in:
Bruce, Matt R 2023-03-07 16:57:09 +00:00
commit 12a1d3cde4
20 changed files with 107 additions and 292 deletions

View File

@ -18,14 +18,12 @@
EA33617D288B19210071C351 /* VDS.h in Headers */ = {isa = PBXBuildFile; fileRef = EA33616F288B19200071C351 /* VDS.h */; settings = {ATTRIBUTES = (Public, ); }; };
EA3361A8288B23300071C351 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361A7288B23300071C351 /* UIColor.swift */; };
EA3361AA288B25E40071C351 /* Disabling.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361A9288B25E40071C351 /* Disabling.swift */; };
EA3361AD288B26190071C351 /* DataTrackable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361AC288B26190071C351 /* DataTrackable.swift */; };
EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361AE288B26310071C351 /* FormFieldable.swift */; };
EA3361B6288B2A410071C351 /* Control.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361B5288B2A410071C351 /* Control.swift */; };
EA3361B8288B2AAA0071C351 /* ViewProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361B7288B2AAA0071C351 /* ViewProtocol.swift */; };
EA3361BD288B2C760071C351 /* TypeAlias.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361BC288B2C760071C351 /* TypeAlias.swift */; };
EA3361BF288B2EA60071C351 /* Handlerable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361BE288B2EA60071C351 /* Handlerable.swift */; };
EA3361C328902D960071C351 /* Toggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C228902D960071C351 /* Toggle.swift */; };
EA3361C5289030FC0071C351 /* Accessable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C4289030FC0071C351 /* Accessable.swift */; };
EA3361C9289054C50071C351 /* Surfaceable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C8289054C50071C351 /* Surfaceable.swift */; };
EA3362042891E14D0071C351 /* VerizonNHGeTX-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */; };
EA3362052891E14D0071C351 /* VerizonNHGeDS-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */; };
@ -134,14 +132,12 @@
EA33617B288B19210071C351 /* VDSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VDSTests.swift; sourceTree = "<group>"; };
EA3361A7288B23300071C351 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = "<group>"; };
EA3361A9288B25E40071C351 /* Disabling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Disabling.swift; sourceTree = "<group>"; };
EA3361AC288B26190071C351 /* DataTrackable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataTrackable.swift; sourceTree = "<group>"; };
EA3361AE288B26310071C351 /* FormFieldable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormFieldable.swift; sourceTree = "<group>"; };
EA3361B5288B2A410071C351 /* Control.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Control.swift; sourceTree = "<group>"; };
EA3361B7288B2AAA0071C351 /* ViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewProtocol.swift; sourceTree = "<group>"; };
EA3361BC288B2C760071C351 /* TypeAlias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeAlias.swift; sourceTree = "<group>"; };
EA3361BE288B2EA60071C351 /* Handlerable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Handlerable.swift; sourceTree = "<group>"; };
EA3361C228902D960071C351 /* Toggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toggle.swift; sourceTree = "<group>"; };
EA3361C4289030FC0071C351 /* Accessable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Accessable.swift; sourceTree = "<group>"; };
EA3361C8289054C50071C351 /* Surfaceable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Surfaceable.swift; sourceTree = "<group>"; };
EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeTX-Bold.otf"; sourceTree = "<group>"; };
EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeDS-Bold.otf"; sourceTree = "<group>"; };
@ -392,10 +388,8 @@
EA3361AB288B25EC0071C351 /* Protocols */ = {
isa = PBXGroup;
children = (
EA3361C4289030FC0071C351 /* Accessable.swift */,
EA4DB2FC28D3D0CA00103EE3 /* AnyEquatable.swift */,
EAA5EEDF28F49DB3003B3210 /* Colorable.swift */,
EA3361AC288B26190071C351 /* DataTrackable.swift */,
EA3361A9288B25E40071C351 /* Disabling.swift */,
EA5E305929510F8B0082B959 /* EnumSubset.swift */,
EAF7F0A1289AFB3900B287F5 /* Errorable.swift */,
@ -773,7 +767,6 @@
EA985BF7296C665E00F2FF2E /* IconName.swift in Sources */,
EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */,
EAC925842911C63100091998 /* Colorable.swift in Sources */,
EA3361C5289030FC0071C351 /* Accessable.swift in Sources */,
EAB5FEF5292D371F00998C17 /* ButtonBase.swift in Sources */,
EA978EC5291D6AFE00ACC883 /* AnyLabelAttribute.swift in Sources */,
EA33622C2891E73B0071C351 /* FontProtocol.swift in Sources */,
@ -829,7 +822,6 @@
EAF7F0B7289C12A600B287F5 /* UITapGestureRecognizer.swift in Sources */,
EA985BF9296C710100F2FF2E /* IconColor.swift in Sources */,
EAB5FED429267EB300998C17 /* UIView.swift in Sources */,
EA3361AD288B26190071C351 /* DataTrackable.swift in Sources */,
EA33623E2892EE950071C351 /* UIDevice.swift in Sources */,
EA985C692971B90B00F2FF2E /* IconSize.swift in Sources */,
EA985C672970C21600F2FF2E /* VDSLayout.swift in Sources */,

View File

@ -17,6 +17,16 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
//--------------------------------------------------
public var subject = PassthroughSubject<Void, Never>()
public var subscribers = Set<AnyCancellable>()
open var onClickSubscriber: AnyCancellable? {
willSet {
if let onClickSubscriber {
onClickSubscriber.cancel()
}
}
didSet {
enabledHighlight = onClickSubscriber != nil
}
}
//--------------------------------------------------
// MARK: - Properties
@ -103,7 +113,13 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
open func updateView() {}
open func updateView() {
updateAccessibilityLabel()
}
open func updateAccessibilityLabel() {
}
open func reset() {
backgroundColor = .clear

View File

@ -75,7 +75,13 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
open func updateView() {}
open func updateView() {
updateAccessibilityLabel()
}
open func updateAccessibilityLabel() {
}
open func reset() {
backgroundColor = .clear

View File

@ -13,7 +13,7 @@ import Combine
/// Badges are visual labels used to convey status or highlight supplemental information.
@objc(VDSBadge)
public class Badge: View, Accessable {
public class Badge: View {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
@ -39,18 +39,6 @@ public class Badge: View, Accessable {
open var maxWidth: CGFloat? { didSet { didChange() }}
open var numberOfLines: Int = 1 { didSet { didChange() }}
open var accessibilityHintEnabled: String? { didSet { didChange() }}
open var accessibilityHintDisabled: String? { didSet { didChange() }}
open var accessibilityValueEnabled: String? { didSet { didChange() }}
open var accessibilityValueDisabled: String? { didSet { didChange() }}
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
//--------------------------------------------------
// MARK: - Constraints
@ -65,8 +53,7 @@ public class Badge: View, Accessable {
open override func setup() {
super.setup()
isAccessibilityElement = true
accessibilityTraits = .staticText
accessibilityElements = [label]
layer.cornerRadius = VDSFormControls.borderradius
addSubview(label)
@ -89,14 +76,6 @@ public class Badge: View, Accessable {
text = ""
maxWidth = nil
numberOfLines = 1
accessibilityHintEnabled = nil
accessibilityHintDisabled = nil
accessibilityValueEnabled = nil
accessibilityValueDisabled = nil
accessibilityLabelEnabled = nil
accessibilityLabelDisabled = nil
setAccessibilityLabel()
}
//--------------------------------------------------
@ -155,9 +134,6 @@ public class Badge: View, Accessable {
} else {
maxWidthConstraint?.isActive = false
}
setAccessibilityLabel()
}
}

View File

@ -143,6 +143,11 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
open func updateView() {
updateLabel()
updateAccessibilityLabel()
}
open func updateAccessibilityLabel() {
}
//--------------------------------------------------

View File

@ -19,15 +19,15 @@ public class Checkbox: CheckboxBase{}
public class SoloCheckbox: CheckboxBase{
public override func initialSetup() {
super.initialSetup()
publisher(for: .touchUpInside)
onClickSubscriber = publisher(for: .touchUpInside)
.sink { control in
control.toggle()
}.store(in: &subscribers)
}
}
}
@objc(VDSCheckboxBase)
open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
open class CheckboxBase: Control, Errorable {
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
@ -153,24 +153,6 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
open var value: AnyHashable? { didSet { didChange() }}
open var dataAnalyticsTrack: String? { didSet { didChange() }}
open var dataClickStream: String? { didSet { didChange() }}
open var dataTrack: String? { didSet { didChange() }}
open var accessibilityHintEnabled: String? { didSet { didChange() }}
open var accessibilityHintDisabled: String? { didSet { didChange() }}
open var accessibilityValueEnabled: String? { didSet { didChange() }}
open var accessibilityValueDisabled: String? { didSet { didChange() }}
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
//--------------------------------------------------
// MARK: - Constraints
//--------------------------------------------------
@ -286,19 +268,9 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
errorText = nil
inputId = nil
value = nil
dataAnalyticsTrack = nil
dataClickStream = nil
dataTrack = nil
accessibilityHintEnabled = nil
accessibilityHintDisabled = nil
accessibilityValueEnabled = nil
accessibilityValueDisabled = nil
accessibilityLabelEnabled = nil
accessibilityLabelDisabled = nil
isSelected = false
updateSelector()
setAccessibilityLabel()
}
/// This will checkbox the state of the Selector and execute the actionBlock if provided.
@ -317,11 +289,12 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
open override func updateView() {
updateLabels()
updateSelector()
setAccessibilityHint()
setAccessibilityValue(isSelected)
setAccessibilityLabel(isSelected)
updateAccessibilityLabel()
}
open override func updateAccessibilityLabel() {
setAccessibilityLabel(for: [label, childLabel, errorLabel])
}
//--------------------------------------------------
// MARK: - Configuration Properties

View File

@ -89,6 +89,10 @@ public class Icon: View {
}
}
public override func updateAccessibilityLabel() {
}
private func getImage(for imageName: String) -> UIImage? {
return BundleManager.shared.image(for: imageName)

View File

@ -137,11 +137,15 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable
//set the attributed text
attributedText = mutableText
accessibilityLabel = text
updateAccessibilityLabel()
}
}
}
open func updateAccessibilityLabel() {
accessibilityLabel = text
}
// MARK: - Private Attributes
private func applyAttributes(_ mutableAttributedString: NSMutableAttributedString) {
actions = []

View File

@ -19,15 +19,15 @@ public class SoloRadioBox: RadioBoxBase{
public override func initialSetup() {
super.initialSetup()
publisher(for: .touchUpInside)
onClickSubscriber = publisher(for: .touchUpInside)
.sink { control in
control.toggle()
}.store(in: &subscribers)
}
}
}
@objc(VDSRadioBoxBase)
open class RadioBoxBase: Control, Accessable, DataTrackable{
open class RadioBoxBase: Control{
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
@ -133,24 +133,6 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
open var inputId: String? { didSet { didChange() }}
open var value: AnyHashable? { didSet { didChange() }}
open var dataAnalyticsTrack: String? { didSet { didChange() }}
open var dataClickStream: String? { didSet { didChange() }}
open var dataTrack: String? { didSet { didChange() }}
open var accessibilityHintEnabled: String? { didSet { didChange() }}
open var accessibilityHintDisabled: String? { didSet { didChange() }}
open var accessibilityValueEnabled: String? { didSet { didChange() }}
open var accessibilityValueDisabled: String? { didSet { didChange() }}
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
//functions
//--------------------------------------------------
@ -242,20 +224,10 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
strikethrough = false
inputId = nil
value = nil
dataAnalyticsTrack = nil
dataClickStream = nil
dataTrack = nil
accessibilityHintEnabled = nil
accessibilityHintDisabled = nil
accessibilityValueEnabled = nil
accessibilityValueDisabled = nil
accessibilityLabelEnabled = nil
accessibilityLabelDisabled = nil
isSelected = false
updateSelector()
setAccessibilityLabel()
}
/// This will radioBox the state of the Selector and execute the actionBlock if provided.
@ -271,12 +243,13 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
open override func updateView() {
updateLabels()
updateSelector()
setAccessibilityHint()
setAccessibilityValue(isSelected)
setAccessibilityLabel(isSelected)
updateAccessibilityLabel()
setNeedsDisplay()
}
open override func updateAccessibilityLabel() {
setAccessibilityLabel(for: [textLabel, subTextLabel, subTextRightLabel])
}
//--------------------------------------------------
// MARK: - Configuration Properties

View File

@ -26,15 +26,15 @@ public class RadioButton: RadioButtonBase {
public class SoloRadioButton: RadioButtonBase {
public override func initialSetup() {
super.initialSetup()
publisher(for: .touchUpInside)
onClickSubscriber = publisher(for: .touchUpInside)
.sink { control in
control.toggle()
}.store(in: &subscribers)
}
}
}
@objc(VDSRadioButtonBase)
open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
open class RadioButtonBase: Control, Errorable {
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
@ -147,24 +147,6 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
open var value: AnyHashable? { didSet { didChange() }}
open var dataAnalyticsTrack: String? { didSet { didChange() }}
open var dataClickStream: String? { didSet { didChange() }}
open var dataTrack: String? { didSet { didChange() }}
open var accessibilityHintEnabled: String? { didSet { didChange() }}
open var accessibilityHintDisabled: String? { didSet { didChange() }}
open var accessibilityValueEnabled: String? { didSet { didChange() }}
open var accessibilityValueDisabled: String? { didSet { didChange() }}
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
//--------------------------------------------------
// MARK: - Constraints
//--------------------------------------------------
@ -283,20 +265,10 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
errorText = nil
inputId = nil
value = nil
dataAnalyticsTrack = nil
dataClickStream = nil
dataTrack = nil
accessibilityHintEnabled = nil
accessibilityHintDisabled = nil
accessibilityValueEnabled = nil
accessibilityValueDisabled = nil
accessibilityLabelEnabled = nil
accessibilityLabelDisabled = nil
isSelected = false
updateSelector()
setAccessibilityLabel()
}
/// This will checkbox the state of the Selector and execute the actionBlock if provided.
@ -317,9 +289,11 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
open override func updateView() {
updateLabels()
updateSelector()
setAccessibilityHint()
setAccessibilityValue(isSelected)
setAccessibilityLabel(isSelected)
updateAccessibilityLabel()
}
open override func updateAccessibilityLabel() {
setAccessibilityLabel(for: [label, childLabel])
}
//--------------------------------------------------

View File

@ -23,15 +23,15 @@ public class RadioSwatch: RadioSwatchBase{
public class SolorRadioSwatch: RadioSwatchBase{
public override func initialSetup() {
super.initialSetup()
publisher(for: .touchUpInside)
onClickSubscriber = publisher(for: .touchUpInside)
.sink { control in
control.toggle()
}.store(in: &subscribers)
}
}
}
@objc(VDSRadioSwatchBase)
open class RadioSwatchBase: Control, Accessable, DataTrackable {
open class RadioSwatchBase: Control {
//--------------------------------------------------
// MARK: - Initializers
@ -74,24 +74,6 @@ open class RadioSwatchBase: Control, Accessable, DataTrackable {
open var value: AnyHashable? { didSet { didChange() }}
open var dataAnalyticsTrack: String? { didSet { didChange() }}
open var dataClickStream: String? { didSet { didChange() }}
open var dataTrack: String? { didSet { didChange() }}
open var accessibilityHintEnabled: String? { didSet { didChange() }}
open var accessibilityHintDisabled: String? { didSet { didChange() }}
open var accessibilityValueEnabled: String? { didSet { didChange() }}
open var accessibilityValueDisabled: String? { didSet { didChange() }}
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
//functions
//--------------------------------------------------
// MARK: - Lifecycle
@ -130,18 +112,8 @@ open class RadioSwatchBase: Control, Accessable, DataTrackable {
strikethrough = false
inputId = nil
value = nil
dataAnalyticsTrack = nil
dataClickStream = nil
dataTrack = nil
accessibilityHintEnabled = nil
accessibilityHintDisabled = nil
accessibilityValueEnabled = nil
accessibilityValueDisabled = nil
accessibilityLabelEnabled = nil
accessibilityLabelDisabled = nil
setNeedsDisplay()
setAccessibilityLabel()
}
open func toggle() {
@ -153,12 +125,13 @@ open class RadioSwatchBase: Control, Accessable, DataTrackable {
// MARK: - State
//--------------------------------------------------
open override func updateView() {
setAccessibilityHint()
setAccessibilityValue(isSelected)
setAccessibilityLabel(isSelected)
layer.setNeedsDisplay()
}
public override func updateAccessibilityLabel() {
accessibilityLabel = text
}
//--------------------------------------------------
// MARK: - Configuration Properties
//--------------------------------------------------

View File

@ -12,7 +12,7 @@ import VDSFormControlsTokens
import Combine
@objc(VDSEntryField)
open class EntryField: Control, Accessable {
open class EntryField: Control {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
@ -160,18 +160,6 @@ open class EntryField: Control, Accessable {
open var readOnly: Bool = false { didSet { didChange() }}
open var accessibilityHintEnabled: String? { didSet { didChange() }}
open var accessibilityHintDisabled: String? { didSet { didChange() }}
open var accessibilityValueEnabled: String? { didSet { didChange() }}
open var accessibilityValueDisabled: String? { didSet { didChange() }}
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
//--------------------------------------------------
// MARK: - Constraints
//--------------------------------------------------
@ -302,14 +290,6 @@ open class EntryField: Control, Accessable {
defaultValue = nil
required = false
readOnly = false
accessibilityHintEnabled = nil
accessibilityHintDisabled = nil
accessibilityValueEnabled = nil
accessibilityValueDisabled = nil
accessibilityLabelEnabled = nil
accessibilityLabelDisabled = nil
setAccessibilityLabel()
}
//--------------------------------------------------
@ -326,7 +306,6 @@ open class EntryField: Control, Accessable {
updateErrorLabel()
updateHelperLabel()
setAccessibilityHint()
backgroundColor = surface.color
}

View File

@ -197,6 +197,10 @@ public class InputField: EntryField, UITextFieldDelegate {
}
}
public override func updateAccessibilityLabel() {
}
open override func updateHelperLabel(){
//remove first
helperLabel.removeFromSuperview()

View File

@ -9,6 +9,7 @@ import Foundation
import Foundation
import VDSColorTokens
import UIKit
import Combine
@objc(VDSTilelet)
open class Tilelet: TileContainer {
@ -61,6 +62,13 @@ open class Tilelet: TileContainer {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open override var onClickSubscriber: AnyCancellable? {
didSet {
isAccessibilityElement = onClickSubscriber != nil
//updateAccessibilityLabel()
}
}
open var titleLockup = TitleLockup().with {
let configs = [
TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall],
@ -213,8 +221,8 @@ open class Tilelet: TileContainer {
color = .black
addContentView(stackView)
isAccessibilityElement = true
accessibilityTraits = .staticText
accessibilityTraits = .link
accessibilityElements = [badge, titleLockup, descriptiveIcon, directionalIcon]
//badge
badgeContainerView.addSubview(badge)
@ -333,9 +341,6 @@ open class Tilelet: TileContainer {
} else {
removeFromSuperview(titleLockupContainerView)
}
accessibilityTraits = enabledHighlight ? .link : .staticText
accessibilityLabel = [titleModel?.text, subTitleModel?.text].compactMap({$0}).joined(separator: ", ")
}
fileprivate func updateIcons() {
@ -387,6 +392,11 @@ open class Tilelet: TileContainer {
updateIcons()
layoutIfNeeded()
updateAccessibilityLabel()
}
open override func updateAccessibilityLabel() {
setAccessibilityLabel(for: [badge.label, titleLockup.eyebrowLabel, titleLockup.titleLabel, titleLockup.subTitleLabel])
}
}

View File

@ -202,8 +202,7 @@ open class TitleLockup: View {
open override func setup() {
super.setup()
isAccessibilityElement = true
accessibilityTraits = .staticText
accessibilityElements = [eyebrowLabel, titleLabel, subTitleLabel]
addSubview(stackView)
stackView.spacing = 0.0
@ -299,8 +298,6 @@ open class TitleLockup: View {
eyebrowLabel.isHidden = eyebrowTextIsEmpty
titleLabel.isHidden = titleTextIsEmpty
subTitleLabel.isHidden = subTitleTextIsEmpty
accessibilityLabel = [eyebrowModel?.text, titleModel?.text, subTitleModel?.text].compactMap({$0}).joined(separator: ", ")
}
}

View File

@ -29,7 +29,7 @@ public class Toggle: ToggleBase{
}
@objc(VDSToggleBase)
open class ToggleBase: Control, Accessable, DataTrackable {
open class ToggleBase: Control {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
@ -148,25 +148,7 @@ open class ToggleBase: Control, Accessable, DataTrackable {
open var inputId: String? { didSet { didChange() }}
open var value: AnyHashable? { didSet { didChange() }}
open var dataAnalyticsTrack: String? { didSet { didChange() }}
open var dataClickStream: String? { didSet { didChange() }}
open var dataTrack: String? { didSet { didChange() }}
open var accessibilityHintEnabled: String? { didSet { didChange() }}
open var accessibilityHintDisabled: String? { didSet { didChange() }}
open var accessibilityValueEnabled: String? { didSet { didChange() }}
open var accessibilityValueDisabled: String? { didSet { didChange() }}
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
//--------------------------------------------------
// MARK: - Constraints
//--------------------------------------------------
@ -305,7 +287,6 @@ open class ToggleBase: Control, Accessable, DataTrackable {
toggleView.backgroundColor = toggleColorConfiguration.getColor(self)
knobView.backgroundColor = knobColorConfiguration.getColor(self)
setAccessibilityLabel()
}
/// This will toggle the state of the Toggle and execute the actionBlock if provided.
@ -320,8 +301,10 @@ open class ToggleBase: Control, Accessable, DataTrackable {
open override func updateView() {
updateLabel()
updateToggle()
setAccessibilityHint()
setAccessibilityValue(isOn)
setAccessibilityLabel(isOn)
updateAccessibilityLabel()
}
open override func updateAccessibilityLabel() {
setAccessibilityLabel(for: [label])
}
}

View File

@ -1,49 +0,0 @@
//
// Accessable.swift
// VDS
//
// Created by Matt Bruce on 7/26/22.
//
import Foundation
import UIKit
public protocol Accessable {
var accessibilityHintEnabled: String? { get set }
var accessibilityHintDisabled: String? { get set }
var accessibilityValueEnabled: String? { get set }
var accessibilityValueDisabled: String? { get set }
var accessibilityLabelEnabled: String? { get set }
var accessibilityLabelDisabled: String? { get set }
}
//Configurations to set within the UIControl
extension Handlerable where Self: UIView, Self: Accessable {
public func setAccessibilityHint(_ override: Bool? = nil) {
let check = override ?? !disabled
if let value = accessibilityHintEnabled, check {
accessibilityHint = value
} else if let value = accessibilityHintDisabled, !check {
accessibilityHint = value
}
}
public func setAccessibilityValue(_ override: Bool? = nil) {
let check = override ?? !disabled
if let value = accessibilityValueEnabled, check {
accessibilityValue = value
} else if let value = accessibilityValueDisabled, !check {
accessibilityValue = value
}
}
public func setAccessibilityLabel(_ override: Bool? = nil) {
let check = override ?? !disabled
if let value = accessibilityLabelEnabled, check {
accessibilityLabel = value
} else if let value = accessibilityLabelDisabled, !check {
accessibilityLabel = value
}
}
}

View File

@ -1,14 +0,0 @@
//
// DataTrackable.swift
// VDS
//
// Created by Matt Bruce on 7/22/22.
//
import Foundation
public protocol DataTrackable {
var dataAnalyticsTrack: String? { get set }
var dataClickStream: String? { get set }
var dataTrack: String? { get set }
}

View File

@ -25,7 +25,6 @@ extension Handlerable {
public func handlerPublisher() -> AnyPublisher<Void, Never> {
subject
.debounce(for: .seconds(Constants.StateDebounce), scheduler: RunLoop.main)
.eraseToAnyPublisher()
}
}

View File

@ -12,6 +12,7 @@ public protocol ViewProtocol {
// Can setup ui here. Should be called in the initialization functions.
func setup()
func updateAccessibilityLabel()
}
extension ViewProtocol where Self: UIView {
@ -21,4 +22,13 @@ extension ViewProtocol where Self: UIView {
setNeedsDisplay()
}
}
public func combineAccessibilityLabel(for views: [UIView]) -> String? {
let labels = views.map({($0.accessibilityLabel?.isEmpty ?? true) ? nil : $0.accessibilityLabel}).compactMap({$0})
return labels.joined(separator: ", ")
}
public func setAccessibilityLabel(for views: [UIView]) {
accessibilityLabel = combineAccessibilityLabel(for: views)
}
}