Merge branch 'feature/accessibilityUpdate' into 'develop'

added some accessibilty updates

See merge request BPHV_MIPS/vds_ios!45
This commit is contained in:
Bruce, Matt R 2023-03-03 22:32:52 +00:00
commit 9fde93d798
11 changed files with 78 additions and 65 deletions

View File

@ -118,6 +118,9 @@ open class Button: ButtonBase, Useable {
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = true
accessibilityTraits = .button
//only 1 of the 2 widths can be on at the same time //only 1 of the 2 widths can be on at the same time
widthConstraint = widthAnchor.constraint(equalToConstant: 0) widthConstraint = widthAnchor.constraint(equalToConstant: 0)
minWidthConstraint = widthAnchor.constraint(greaterThanOrEqualToConstant: size.minimumWidth) minWidthConstraint = widthAnchor.constraint(greaterThanOrEqualToConstant: size.minimumWidth)

View File

@ -109,7 +109,6 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
backgroundColor = .clear backgroundColor = .clear
translatesAutoresizingMaskIntoConstraints = false translatesAutoresizingMaskIntoConstraints = false
accessibilityCustomActions = [] accessibilityCustomActions = []
accessibilityTraits = .staticText
setup() setup()
setupDidChangeEvent() setupDidChangeEvent()
updateView() updateView()
@ -130,7 +129,6 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
disabled = false disabled = false
text = nil text = nil
accessibilityCustomActions = [] accessibilityCustomActions = []
accessibilityTraits = .button
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -133,8 +133,6 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
//-------------------------------------------------- //--------------------------------------------------
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = true
accessibilityTraits = .button
addSubview(collectionView) addSubview(collectionView)
collectionView.pinToSuperView() collectionView.pinToSuperView()
} }

View File

@ -73,6 +73,8 @@ open class TextLink: ButtonBase {
//-------------------------------------------------- //--------------------------------------------------
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = true
accessibilityTraits = .link
if let titleLabel { if let titleLabel {
addSubview(line) addSubview(line)
@ -88,7 +90,8 @@ open class TextLink: ButtonBase {
super.reset() super.reset()
size = .large size = .large
accessibilityCustomActions = [] accessibilityCustomActions = []
accessibilityTraits = .staticText isAccessibilityElement = true
accessibilityTraits = .link
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -231,6 +231,9 @@ internal class CaretView: View {
override open func setup() { override open func setup() {
super.setup() super.setup()
defaultState() defaultState()
isAccessibilityElement = true
accessibilityTraits = .link
} }
//------------------------------------------------------ //------------------------------------------------------

View File

@ -75,8 +75,6 @@ public class CheckboxGroupBase<HandlerType: CheckboxBase>: SelectorGroupHandlerB
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = true
accessibilityTraits = .button
addSubview(mainStackView) addSubview(mainStackView)
mainStackView.pinToSuperView() mainStackView.pinToSuperView()

View File

@ -49,6 +49,9 @@ public class Icon: View {
widthConstraint?.isActive = true widthConstraint?.isActive = true
backgroundColor = .clear backgroundColor = .clear
isAccessibilityElement = true
accessibilityTraits = .image
} }
open override func reset() { open override func reset() {

View File

@ -109,8 +109,6 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable
textPosition = .left textPosition = .left
text = nil text = nil
attributedText = nil attributedText = nil
accessibilityCustomActions = []
accessibilityTraits = .staticText
numberOfLines = 0 numberOfLines = 0
backgroundColor = .clear backgroundColor = .clear
} }
@ -125,9 +123,9 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable
font = textStyle.font font = textStyle.font
if let text = text, let font = font, let textColor = textColor { if let text = text, let font = font, let textColor = textColor {
//clear the arrays holding actions
accessibilityCustomActions = [] accessibilityCustomActions = []
//clear the arrays holding actions
//create the primary string //create the primary string
let startingAttributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor] let startingAttributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor]
let mutableText = NSMutableAttributedString(string: text, attributes: startingAttributes) let mutableText = NSMutableAttributedString(string: text, attributes: startingAttributes)
@ -139,6 +137,7 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable
//set the attributed text //set the attributed text
attributedText = mutableText attributedText = mutableText
accessibilityLabel = text
} }
} }
} }

View File

@ -82,8 +82,6 @@ public class RadioSwatchGroupBase<HandlerType: RadioSwatchBase>: SelectorGroupSe
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = true
accessibilityTraits = .button
addSubview(label) addSubview(label)
addSubview(collectionView) addSubview(collectionView)

View File

@ -213,6 +213,9 @@ open class Tilelet: TileContainer {
color = .black color = .black
addContentView(stackView) addContentView(stackView)
isAccessibilityElement = true
accessibilityTraits = .staticText
//badge //badge
badgeContainerView.addSubview(badge) badgeContainerView.addSubview(badge)
badge badge
@ -330,6 +333,9 @@ open class Tilelet: TileContainer {
} else { } else {
removeFromSuperview(titleLockupContainerView) removeFromSuperview(titleLockupContainerView)
} }
accessibilityTraits = enabledHighlight ? .link : .staticText
accessibilityLabel = [titleModel?.text, subTitleModel?.text].compactMap({$0}).joined(separator: ", ")
} }
fileprivate func updateIcons() { fileprivate func updateIcons() {

View File

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