Merge branch 'feature/accessibilityUpdate' into 'develop'
added some accessibilty updates See merge request BPHV_MIPS/vds_ios!45
This commit is contained in:
commit
9fde93d798
@ -118,6 +118,9 @@ open class Button: ButtonBase, Useable {
|
||||
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .button
|
||||
|
||||
//only 1 of the 2 widths can be on at the same time
|
||||
widthConstraint = widthAnchor.constraint(equalToConstant: 0)
|
||||
minWidthConstraint = widthAnchor.constraint(greaterThanOrEqualToConstant: size.minimumWidth)
|
||||
|
||||
@ -109,7 +109,6 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
||||
backgroundColor = .clear
|
||||
translatesAutoresizingMaskIntoConstraints = false
|
||||
accessibilityCustomActions = []
|
||||
accessibilityTraits = .staticText
|
||||
setup()
|
||||
setupDidChangeEvent()
|
||||
updateView()
|
||||
@ -130,7 +129,6 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
||||
disabled = false
|
||||
text = nil
|
||||
accessibilityCustomActions = []
|
||||
accessibilityTraits = .button
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -133,8 +133,6 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
||||
//--------------------------------------------------
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .button
|
||||
addSubview(collectionView)
|
||||
collectionView.pinToSuperView()
|
||||
}
|
||||
|
||||
@ -73,7 +73,9 @@ open class TextLink: ButtonBase {
|
||||
//--------------------------------------------------
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .link
|
||||
|
||||
if let titleLabel {
|
||||
addSubview(line)
|
||||
line.pinLeading(titleLabel.leadingAnchor)
|
||||
@ -88,7 +90,8 @@ open class TextLink: ButtonBase {
|
||||
super.reset()
|
||||
size = .large
|
||||
accessibilityCustomActions = []
|
||||
accessibilityTraits = .staticText
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .link
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -231,6 +231,9 @@ internal class CaretView: View {
|
||||
override open func setup() {
|
||||
super.setup()
|
||||
defaultState()
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .link
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
|
||||
@ -75,8 +75,6 @@ public class CheckboxGroupBase<HandlerType: CheckboxBase>: SelectorGroupHandlerB
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .button
|
||||
addSubview(mainStackView)
|
||||
|
||||
mainStackView.pinToSuperView()
|
||||
|
||||
@ -49,6 +49,9 @@ public class Icon: View {
|
||||
widthConstraint?.isActive = true
|
||||
|
||||
backgroundColor = .clear
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .image
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
|
||||
@ -109,8 +109,6 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable
|
||||
textPosition = .left
|
||||
text = nil
|
||||
attributedText = nil
|
||||
accessibilityCustomActions = []
|
||||
accessibilityTraits = .staticText
|
||||
numberOfLines = 0
|
||||
backgroundColor = .clear
|
||||
}
|
||||
@ -125,9 +123,9 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable
|
||||
font = textStyle.font
|
||||
|
||||
if let text = text, let font = font, let textColor = textColor {
|
||||
//clear the arrays holding actions
|
||||
accessibilityCustomActions = []
|
||||
|
||||
|
||||
//clear the arrays holding actions
|
||||
//create the primary string
|
||||
let startingAttributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor]
|
||||
let mutableText = NSMutableAttributedString(string: text, attributes: startingAttributes)
|
||||
@ -139,10 +137,11 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable
|
||||
|
||||
//set the attributed text
|
||||
attributedText = mutableText
|
||||
accessibilityLabel = text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Private Attributes
|
||||
private func applyAttributes(_ mutableAttributedString: NSMutableAttributedString) {
|
||||
actions = []
|
||||
|
||||
@ -82,8 +82,6 @@ public class RadioSwatchGroupBase<HandlerType: RadioSwatchBase>: SelectorGroupSe
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .button
|
||||
addSubview(label)
|
||||
addSubview(collectionView)
|
||||
|
||||
|
||||
@ -48,75 +48,75 @@ open class Tilelet: TileContainer {
|
||||
private var titleLockupContainerView = UIView().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
|
||||
|
||||
private var badgeContainerView = UIView().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
|
||||
|
||||
private let iconContainerView = UIView().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
$0.backgroundColor = .clear
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
open var titleLockup = TitleLockup().with {
|
||||
let configs = [
|
||||
TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall],
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium
|
||||
],
|
||||
spacing: 8.0,
|
||||
deviceType: .iPhone),
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium
|
||||
],
|
||||
spacing: 8.0,
|
||||
deviceType: .iPhone),
|
||||
|
||||
TextStyle.DeviceSpacingConfig([.titleMedium, .boldTitleMedium,
|
||||
.titleLarge, .boldTitleLarge],
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium,
|
||||
.bodyLarge, .boldBodyLarge],
|
||||
spacing: 8.0,
|
||||
deviceType: .iPhone),
|
||||
.titleLarge, .boldTitleLarge],
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium,
|
||||
.bodyLarge, .boldBodyLarge],
|
||||
spacing: 8.0,
|
||||
deviceType: .iPhone),
|
||||
|
||||
TextStyle.DeviceSpacingConfig([.titleXLarge, .boldTitleXLarge],
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium,
|
||||
.bodyLarge, .boldBodyLarge,
|
||||
.titleMedium, .boldTitleMedium
|
||||
],
|
||||
spacing: 12.0,
|
||||
deviceType: .iPhone),
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium,
|
||||
.bodyLarge, .boldBodyLarge,
|
||||
.titleMedium, .boldTitleMedium
|
||||
],
|
||||
spacing: 12.0,
|
||||
deviceType: .iPhone),
|
||||
|
||||
TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall,
|
||||
.titleMedium, .boldTitleMedium],
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium,
|
||||
.bodyLarge, .boldBodyLarge
|
||||
],
|
||||
spacing: 8.0,
|
||||
deviceType: .iPad),
|
||||
.titleMedium, .boldTitleMedium],
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium,
|
||||
.bodyLarge, .boldBodyLarge
|
||||
],
|
||||
spacing: 8.0,
|
||||
deviceType: .iPad),
|
||||
|
||||
TextStyle.DeviceSpacingConfig([.titleLarge, .boldTitleLarge],
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium,
|
||||
.bodyLarge, .boldBodyLarge,
|
||||
.titleSmall, .boldTitleSmall
|
||||
],
|
||||
spacing: 12.0,
|
||||
deviceType: .iPad),
|
||||
neighboring: [
|
||||
.bodySmall, .boldBodySmall,
|
||||
.bodyMedium, .boldBodyMedium,
|
||||
.bodyLarge, .boldBodyLarge,
|
||||
.titleSmall, .boldTitleSmall
|
||||
],
|
||||
spacing: 12.0,
|
||||
deviceType: .iPad),
|
||||
|
||||
TextStyle.DeviceSpacingConfig([.titleXLarge, .boldTitleXLarge],
|
||||
neighboring: [
|
||||
.bodyLarge, .boldBodyLarge,
|
||||
.titleMedium, .boldTitleMedium
|
||||
],
|
||||
spacing: 16.0,
|
||||
deviceType: .iPad)
|
||||
neighboring: [
|
||||
.bodyLarge, .boldBodyLarge,
|
||||
.titleMedium, .boldTitleMedium
|
||||
],
|
||||
spacing: 16.0,
|
||||
deviceType: .iPad)
|
||||
|
||||
]
|
||||
|
||||
@ -213,6 +213,9 @@ open class Tilelet: TileContainer {
|
||||
color = .black
|
||||
addContentView(stackView)
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .staticText
|
||||
|
||||
//badge
|
||||
badgeContainerView.addSubview(badge)
|
||||
badge
|
||||
@ -286,7 +289,7 @@ open class Tilelet: TileContainer {
|
||||
if let subTitleModel, !subTitleModel.text.isEmpty {
|
||||
showTitleLockup = true
|
||||
}
|
||||
|
||||
|
||||
if showTitleLockup {
|
||||
//flip the surface for the titleLockup
|
||||
titleLockup.surface = color == .black ? Surface.dark : Surface.light
|
||||
@ -330,6 +333,9 @@ open class Tilelet: TileContainer {
|
||||
} else {
|
||||
removeFromSuperview(titleLockupContainerView)
|
||||
}
|
||||
|
||||
accessibilityTraits = enabledHighlight ? .link : .staticText
|
||||
accessibilityLabel = [titleModel?.text, subTitleModel?.text].compactMap({$0}).joined(separator: ", ")
|
||||
}
|
||||
|
||||
fileprivate func updateIcons() {
|
||||
@ -351,7 +357,7 @@ open class Tilelet: TileContainer {
|
||||
//iconContainer
|
||||
descriptiveIcon.isHidden = descriptiveIconModel == nil
|
||||
directionalIcon.isHidden = directionalIconModel == nil
|
||||
|
||||
|
||||
if showIconContainerView {
|
||||
//spacing before iconContainerView
|
||||
var view: UIView?
|
||||
|
||||
@ -203,7 +203,7 @@ open class TitleLockup: View {
|
||||
super.setup()
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .button
|
||||
accessibilityTraits = .staticText
|
||||
addSubview(stackView)
|
||||
|
||||
stackView.spacing = 0.0
|
||||
@ -214,6 +214,7 @@ open class TitleLockup: View {
|
||||
|
||||
//pin stackview to edges
|
||||
stackView.pinToSuperView()
|
||||
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
@ -236,7 +237,7 @@ open class TitleLockup: View {
|
||||
//--------------------------------------------------
|
||||
open override func updateView() {
|
||||
super.updateView()
|
||||
|
||||
|
||||
let allLabelsTextPosition = textPosition.value
|
||||
var eyebrowTextIsEmpty = true
|
||||
var titleTextIsEmpty = true
|
||||
@ -298,5 +299,8 @@ open class TitleLockup: View {
|
||||
eyebrowLabel.isHidden = eyebrowTextIsEmpty
|
||||
titleLabel.isHidden = titleTextIsEmpty
|
||||
subTitleLabel.isHidden = subTitleTextIsEmpty
|
||||
|
||||
accessibilityLabel = [eyebrowModel?.text, titleModel?.text, subTitleModel?.text].compactMap({$0}).joined(separator: ", ")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user