accessibility for designed components
This commit is contained in:
parent
0e6a4ef818
commit
01ad16d9ff
@ -11,12 +11,17 @@ import Foundation
|
|||||||
|
|
||||||
@objcMembers open class ListRVWheel: TableViewCell {
|
@objcMembers open class ListRVWheel: TableViewCell {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Outlets
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
let wheel = Wheel()
|
let wheel = Wheel()
|
||||||
let leftLabel = Label.createLabelBoldBodySmall(true)
|
let leftLabel = Label.createLabelBoldBodySmall(true)
|
||||||
let rightLabel = Label.createLabelRegularBodySmall(true)
|
let rightLabel = Label.createLabelRegularBodySmall(true)
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
var stack: Stack<StackModel>
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -41,9 +46,12 @@ import Foundation
|
|||||||
|
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -58,6 +66,7 @@ import Foundation
|
|||||||
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
||||||
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
wheel.set(with: model.wheel, delegateObject, additionalData)
|
wheel.set(with: model.wheel, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
@ -69,4 +78,27 @@ import Foundation
|
|||||||
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 70
|
return 70
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Accessibility
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
||||||
|
message += leftLabelText
|
||||||
|
}
|
||||||
|
|
||||||
|
if let wheelLabel = wheel.accessibilityLabel, !wheelLabel.isEmpty {
|
||||||
|
message += wheelLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty {
|
||||||
|
message += rightLabelText
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,10 +14,15 @@ import Foundation
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public var stack: Stack<StackModel>
|
|
||||||
public let button = PillButton()
|
public let button = PillButton()
|
||||||
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -39,9 +44,12 @@ import Foundation
|
|||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
|
accessibilityValue = button.accessibilityValue
|
||||||
|
accessibilityHint = button.accessibilityHint
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -70,10 +78,6 @@ import Foundation
|
|||||||
|
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let checkboxLabel = button.accessibilityLabel {
|
|
||||||
message += checkboxLabel + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
message += eyebrowLabel + ", "
|
message += eyebrowLabel + ", "
|
||||||
}
|
}
|
||||||
@ -83,7 +87,11 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
message += bodyLabel
|
message += bodyLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let buttonLabel = button.accessibilityLabel {
|
||||||
|
message += buttonLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
@ -111,4 +119,8 @@ import Foundation
|
|||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func accessibilityActivate() -> Bool {
|
||||||
|
return button.accessibilityActivate()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,8 @@ import Foundation
|
|||||||
rightImage.addSizeConstraintsForAspectRatio = true
|
rightImage.addSizeConstraintsForAspectRatio = true
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
@ -54,6 +56,7 @@ import Foundation
|
|||||||
|
|
||||||
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
||||||
rightImage.set(with: model.image, delegateObject, additionalData)
|
rightImage.set(with: model.image, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -64,4 +67,23 @@ import Foundation
|
|||||||
super.reset()
|
super.reset()
|
||||||
leftLabel.styleBoldBodySmall(true)
|
leftLabel.styleBoldBodySmall(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Accessibility
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
||||||
|
message += leftLabelText + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let rightImageText = rightImage.accessibilityLabel, !rightImageText.isEmpty {
|
||||||
|
message += rightImageText
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,7 @@ import Foundation
|
|||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
@ -79,6 +80,7 @@ import Foundation
|
|||||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||||
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
arrow.set(with: model.arrow, delegateObject, additionalData)
|
arrow.set(with: model.arrow, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -91,48 +93,55 @@ import Foundation
|
|||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
var message = ""
|
|
||||||
|
|
||||||
checkbox.updateAccessibilityLabel()
|
|
||||||
|
|
||||||
if let checkboxLabel = checkbox.accessibilityLabel {
|
|
||||||
message += checkboxLabel + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
|
||||||
message += eyebrowLabel + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
|
||||||
message += headlineLabel + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
|
||||||
message += bodyLabel
|
|
||||||
}
|
|
||||||
|
|
||||||
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
|
|
||||||
isAccessibilityElement = !linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
checkbox.isAccessibilityElement = linkShowing
|
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
|
message += eyebrowLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
|
message += bodyLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let rightLabelText = rightLabel.text {
|
||||||
|
message += rightLabelText
|
||||||
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
|
||||||
checkbox.accessibilityLabel = message
|
|
||||||
var elements: [UIView] = []
|
var elements: [UIView] = []
|
||||||
|
|
||||||
if message.count > 0 {
|
if let eyebrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyebrowText.isEmpty {
|
||||||
elements.append(checkbox)
|
elements.append(eyebrowHeadlineBodyLink.eyebrow)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineText = eyebrowHeadlineBodyLink.headline.text, !headlineText.isEmpty {
|
||||||
|
elements.append(eyebrowHeadlineBodyLink.headline)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyText = eyebrowHeadlineBodyLink.body.text, !bodyText.isEmpty {
|
||||||
|
elements.append(eyebrowHeadlineBodyLink.body)
|
||||||
}
|
}
|
||||||
|
|
||||||
if linkShowing {
|
if linkShowing {
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty {
|
||||||
|
elements.append(rightLabel)
|
||||||
|
}
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,11 +14,16 @@ import Foundation
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
private let stack: Stack<StackModel>
|
|
||||||
public let headlineBody = HeadlineBody()
|
public let headlineBody = HeadlineBody()
|
||||||
public let arrow = Arrow()
|
public let arrow = Arrow()
|
||||||
public let rightLabel = Label.createLabelRegularBodySmall(true)
|
public let rightLabel = Label.createLabelRegularBodySmall(true)
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
let arrowAndRightLabelStack: Stack<StackModel>
|
let arrowAndRightLabelStack: Stack<StackModel>
|
||||||
|
private let stack: Stack<StackModel>
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
@ -54,6 +59,8 @@ import Foundation
|
|||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
arrowAndRightLabelStack.restack()
|
arrowAndRightLabelStack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -68,6 +75,7 @@ import Foundation
|
|||||||
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
arrow.set(with: model.arrow, delegateObject, additionalData)
|
arrow.set(with: model.arrow, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -78,4 +86,27 @@ import Foundation
|
|||||||
super.reset()
|
super.reset()
|
||||||
headlineBody.styleListItem()
|
headlineBody.styleListItem()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Accessibility
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let headlineText = headlineBody.headlineLabel.text, !headlineText.isEmpty {
|
||||||
|
message += headlineText + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let messageText = headlineBody.messageLabel.text, !messageText.isEmpty {
|
||||||
|
message += messageText + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty {
|
||||||
|
message += rightLabelText
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,10 +14,15 @@ import Foundation
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var stack: Stack<StackModel>
|
|
||||||
public let link = Link()
|
public let link = Link()
|
||||||
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Outlets
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -39,8 +44,10 @@ import Foundation
|
|||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -54,9 +61,64 @@ import Foundation
|
|||||||
|
|
||||||
link.set(with: model.link, delegateObject, additionalData)
|
link.set(with: model.link, delegateObject, additionalData)
|
||||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 90
|
return 90
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Accessibility
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
|
message += eyebrowLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
|
message += bodyLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let linkLabel = link.accessibilityLabel {
|
||||||
|
message += linkLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
|
|
||||||
|
isAccessibilityElement = !linkShowing
|
||||||
|
link.isAccessibilityElement = linkShowing
|
||||||
|
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
||||||
|
|
||||||
|
if !linkShowing {
|
||||||
|
// Make whole cell focusable if no link.
|
||||||
|
accessibilityLabel = message
|
||||||
|
} else {
|
||||||
|
// Allow only radio button and link to be focused on.
|
||||||
|
link.accessibilityLabel = message
|
||||||
|
var elements: [UIView] = []
|
||||||
|
|
||||||
|
if linkShowing {
|
||||||
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !message.isEmpty {
|
||||||
|
elements.append(link)
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityElements = elements
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func accessibilityActivate() -> Bool {
|
||||||
|
return link.accessibilityActivate()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,11 +14,16 @@ import Foundation
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public var stack: Stack<StackModel>
|
|
||||||
public let leftLabel = Label.createLabelBoldBodySmall(true)
|
public let leftLabel = Label.createLabelBoldBodySmall(true)
|
||||||
public let rightLabel = Label.createLabelRegularBodySmall(true)
|
public let rightLabel = Label.createLabelRegularBodySmall(true)
|
||||||
public let bar = Line()
|
public let bar = Line()
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -46,6 +51,8 @@ import Foundation
|
|||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -60,6 +67,7 @@ import Foundation
|
|||||||
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
||||||
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
bar.set(with: model.bar, delegateObject, additionalData)
|
bar.set(with: model.bar, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -68,8 +76,28 @@ import Foundation
|
|||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
|
|
||||||
leftLabel.styleBoldBodySmall(true)
|
leftLabel.styleBoldBodySmall(true)
|
||||||
rightLabel.styleRegularBodySmall(true)
|
rightLabel.styleRegularBodySmall(true)
|
||||||
bar.setStyle(.heavy)
|
bar.setStyle(.heavy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Accessibility
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
||||||
|
message += leftLabelText + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty {
|
||||||
|
message += rightLabelText
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,6 +117,15 @@ public typealias ButtonAction = (Button) -> ()
|
|||||||
open func reset() {
|
open func reset() {
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Accessibility
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
open override func accessibilityActivate() -> Bool {
|
||||||
|
buttonAction?(self)
|
||||||
|
return buttonAction != nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user