Merge branch 'develop' into feature/carousel_swipeActionTagging
* develop: back button image name fix Move hiding the line in nav bar for tab bar, to the tab bar. swap trait and hint due to apple defect trait miss change ordering image fix missed image commit image accessibility fix remove unneeded code remove duplicate remove duplicate code device list remove unnecessary setters accessibility columns right variable changes left variable accessibility clean Update accessibility for numberd left variable
This commit is contained in:
commit
0a325e2686
@ -157,9 +157,9 @@ import MVMCore
|
|||||||
override public init(frame: CGRect) {
|
override public init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
accessibilityTraits = .button
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "checkbox_action_hint")
|
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "checkbox_action_hint")
|
||||||
|
accessibilityTraits = .button
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -147,8 +147,8 @@ import UIKit
|
|||||||
|
|
||||||
addTarget(self, action: #selector(tapAction), for: .touchUpInside)
|
addTarget(self, action: #selector(tapAction), for: .touchUpInside)
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .button
|
|
||||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||||
|
accessibilityTraits = .button
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,12 +115,12 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
|
|
||||||
for i in 0..<numberOfPages {
|
for i in 0..<numberOfPages {
|
||||||
let bar = View()
|
let bar = View()
|
||||||
bar.accessibilityTraits = .button
|
|
||||||
bar.isAccessibilityElement = true
|
bar.isAccessibilityElement = true
|
||||||
if let accessibleValueFormat = accessibilityValueFormat, let accessibleIndex = ordinalFormatter.string(from: NSNumber(value: i + 1)) {
|
if let accessibleValueFormat = accessibilityValueFormat, let accessibleIndex = ordinalFormatter.string(from: NSNumber(value: i + 1)) {
|
||||||
bar.accessibilityLabel = String(format: accessibleValueFormat, accessibleIndex, numberOfPages)
|
bar.accessibilityLabel = String(format: accessibleValueFormat, accessibleIndex, numberOfPages)
|
||||||
}
|
}
|
||||||
bar.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
bar.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
||||||
|
bar.accessibilityTraits = .button
|
||||||
bar.widthAnchor.constraint(equalToConstant: BarsIndicatorView.indicatorBarWidth).isActive = true
|
bar.widthAnchor.constraint(equalToConstant: BarsIndicatorView.indicatorBarWidth).isActive = true
|
||||||
bar.backgroundColor = isEnabled ? (i == currentIndex ? currentIndicatorColor : indicatorColor) : disabledIndicatorColor
|
bar.backgroundColor = isEnabled ? (i == currentIndex ? currentIndicatorColor : indicatorColor) : disabledIndicatorColor
|
||||||
let barHeight = i == currentIndex ? BarsIndicatorView.indicatorBarHeight.selected : BarsIndicatorView.indicatorBarHeight.unselected
|
let barHeight = i == currentIndex ? BarsIndicatorView.indicatorBarHeight.selected : BarsIndicatorView.indicatorBarHeight.unselected
|
||||||
|
|||||||
@ -215,9 +215,9 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .button
|
|
||||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccToggleHint")
|
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccToggleHint")
|
||||||
accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "Toggle_buttonlabel")
|
accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "Toggle_buttonlabel")
|
||||||
|
accessibilityTraits = .button
|
||||||
|
|
||||||
heightConstraint = heightAnchor.constraint(equalToConstant: Self.containerSize.height)
|
heightConstraint = heightAnchor.constraint(equalToConstant: Self.containerSize.height)
|
||||||
heightConstraint?.isActive = true
|
heightConstraint?.isActive = true
|
||||||
|
|||||||
@ -58,10 +58,8 @@ import Foundation
|
|||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
verticalStack.restack()
|
verticalStack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
accessibilityTraits = button.accessibilityTraits
|
|
||||||
accessibilityHint = button.accessibilityHint
|
accessibilityHint = button.accessibilityHint
|
||||||
updateAccessibilityLabel()
|
accessibilityTraits = button.accessibilityTraits
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -100,10 +98,8 @@ import Foundation
|
|||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func getAccessibilityMessage() -> String? {
|
||||||
|
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let eyebrowText = eyebrow.text, !eyebrowText.isEmpty {
|
if let eyebrowText = eyebrow.text, !eyebrowText.isEmpty {
|
||||||
message += eyebrowText + ", "
|
message += eyebrowText + ", "
|
||||||
}
|
}
|
||||||
@ -120,11 +116,28 @@ import Foundation
|
|||||||
message += body2Text + ", "
|
message += body2Text + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let rightImageViewText = rightImageView.accessibilityLabel, !rightImageViewText.isEmpty {
|
if let rightImageViewText = rightImageView.imageView.accessibilityLabel, !rightImageViewText.isEmpty {
|
||||||
message += rightImageViewText
|
message += rightImageViewText
|
||||||
}
|
}
|
||||||
|
return message.count > 0 ? message : nil
|
||||||
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
func updateAccessibilityLabel() {
|
||||||
|
if let accessoryView = accessoryView {
|
||||||
|
// Both caret and button. Read all content on caret.
|
||||||
|
isAccessibilityElement = false
|
||||||
|
accessoryView.accessibilityLabel = getAccessibilityMessage()
|
||||||
|
accessibilityElements = [accessoryView, button]
|
||||||
|
} else {
|
||||||
|
// Make whole cell focusable if no action.
|
||||||
|
isAccessibilityElement = true
|
||||||
|
if let message = getAccessibilityMessage(),
|
||||||
|
let buttonTitle = button.titleLabel?.text {
|
||||||
|
accessibilityLabel = message + ", " + buttonTitle
|
||||||
|
} else {
|
||||||
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func accessibilityActivate() -> Bool {
|
open override func accessibilityActivate() -> Bool {
|
||||||
|
|||||||
@ -58,10 +58,8 @@ import Foundation
|
|||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
verticalStack.restack()
|
verticalStack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
accessibilityTraits = button.accessibilityTraits
|
|
||||||
accessibilityHint = button.accessibilityHint
|
accessibilityHint = button.accessibilityHint
|
||||||
updateAccessibilityLabel()
|
accessibilityTraits = button.accessibilityTraits
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -100,10 +98,8 @@ import Foundation
|
|||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func getAccessibilityMessage() -> String? {
|
||||||
|
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let eyebrowText = eyebrow.text, !eyebrowText.isEmpty {
|
if let eyebrowText = eyebrow.text, !eyebrowText.isEmpty {
|
||||||
message += eyebrowText + ", "
|
message += eyebrowText + ", "
|
||||||
}
|
}
|
||||||
@ -120,11 +116,28 @@ import Foundation
|
|||||||
message += body2Text + ", "
|
message += body2Text + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let rightImageViewText = rightImageView.accessibilityLabel, !rightImageViewText.isEmpty {
|
if let rightImageViewText = rightImageView.imageView.accessibilityLabel, !rightImageViewText.isEmpty {
|
||||||
message += rightImageViewText
|
message += rightImageViewText
|
||||||
}
|
}
|
||||||
|
return message.count > 0 ? message : nil
|
||||||
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
func updateAccessibilityLabel() {
|
||||||
|
if let accessoryView = accessoryView {
|
||||||
|
// Both caret and button. Read all content on caret.
|
||||||
|
isAccessibilityElement = false
|
||||||
|
accessoryView.accessibilityLabel = getAccessibilityMessage()
|
||||||
|
accessibilityElements = [accessoryView, button]
|
||||||
|
} else {
|
||||||
|
// Make whole cell focusable if no action.
|
||||||
|
isAccessibilityElement = true
|
||||||
|
if let message = getAccessibilityMessage(),
|
||||||
|
let buttonTitle = button.titleLabel?.text {
|
||||||
|
accessibilityLabel = message + ", " + buttonTitle
|
||||||
|
} else {
|
||||||
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func accessibilityActivate() -> Bool {
|
open override func accessibilityActivate() -> Bool {
|
||||||
|
|||||||
@ -114,7 +114,7 @@ import Foundation
|
|||||||
message += body2Text + ", "
|
message += body2Text + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let rightImageLabel = rightImage.accessibilityLabel, !rightImageLabel.isEmpty {
|
if let rightImageLabel = rightImage.imageView.accessibilityLabel, !rightImageLabel.isEmpty {
|
||||||
message += rightImageLabel
|
message += rightImageLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,8 +145,8 @@ import Foundation
|
|||||||
views.append(twoLinkView.leftLink)
|
views.append(twoLinkView.leftLink)
|
||||||
views.append(twoLinkView.rightLink)
|
views.append(twoLinkView.rightLink)
|
||||||
|
|
||||||
if let rightImageLabel = rightImage.accessibilityLabel, !rightImageLabel.isEmpty {
|
if let rightImageLabel = rightImage.imageView.accessibilityLabel, !rightImageLabel.isEmpty {
|
||||||
views.append(rightImage)
|
views.append(rightImage.imageView)
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityElements = views
|
accessibilityElements = views
|
||||||
|
|||||||
@ -111,7 +111,7 @@ import Foundation
|
|||||||
message += body2Text + ", "
|
message += body2Text + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let rightImageLabel = rightImage.accessibilityLabel, !rightImageLabel.isEmpty {
|
if let rightImageLabel = rightImage.imageView.accessibilityLabel, !rightImageLabel.isEmpty {
|
||||||
message += rightImageLabel
|
message += rightImageLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,8 +142,8 @@ import Foundation
|
|||||||
views.append(twoLinkView.leftLink)
|
views.append(twoLinkView.leftLink)
|
||||||
views.append(twoLinkView.rightLink)
|
views.append(twoLinkView.rightLink)
|
||||||
|
|
||||||
if let rightImageLabel = rightImage.accessibilityLabel, !rightImageLabel.isEmpty {
|
if let rightImageLabel = rightImage.imageView.accessibilityLabel, !rightImageLabel.isEmpty {
|
||||||
views.append(rightImage)
|
views.append(rightImage.imageView)
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityElements = views
|
accessibilityElements = views
|
||||||
|
|||||||
@ -54,8 +54,6 @@ import Foundation
|
|||||||
arrow.pinHeightAndWidth()
|
arrow.pinHeightAndWidth()
|
||||||
arrowAndLabel2Stack.restack()
|
arrowAndLabel2Stack.restack()
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -92,7 +90,7 @@ import Foundation
|
|||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let label1Text = label1.text, !label1Text.isEmpty {
|
if let label1Text = label1.text, !label1Text.isEmpty {
|
||||||
|
|||||||
@ -49,11 +49,9 @@ import Foundation
|
|||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
|
||||||
isAccessibilityElement = true
|
|
||||||
checkbox.isAccessibilityElement = false
|
|
||||||
accessibilityTraits = checkbox.accessibilityTraits
|
|
||||||
accessibilityHint = checkbox.accessibilityHint
|
accessibilityHint = checkbox.accessibilityHint
|
||||||
// Update accessibility label on radio button state change.
|
accessibilityTraits = checkbox.accessibilityTraits
|
||||||
|
// Update accessibility label on checkbox state change.
|
||||||
observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in
|
observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
self?.updateAccessibilityLabel()
|
self?.updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
@ -92,41 +90,19 @@ import Foundation
|
|||||||
message += checkboxLabel + ", "
|
message += checkboxLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text, !eyebrowLabel.isEmpty {
|
if let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() {
|
||||||
message += eyebrowLabel + ", "
|
message += label
|
||||||
}
|
|
||||||
|
|
||||||
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text, !headlineLabel.isEmpty {
|
|
||||||
message += headlineLabel + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let bodyLabel = eyebrowHeadlineBodyLink.body.text, !bodyLabel.isEmpty {
|
|
||||||
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
|
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
// Allow only checkbox and link to be focused on.
|
||||||
checkbox.accessibilityLabel = message
|
checkbox.accessibilityLabel = message
|
||||||
var elements: [UIView] = []
|
accessibilityElements = [checkbox, eyebrowHeadlineBodyLink.link]
|
||||||
|
|
||||||
if message.count > 0 {
|
|
||||||
elements.append(checkbox)
|
|
||||||
}
|
|
||||||
|
|
||||||
if linkShowing {
|
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityElements = elements
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,10 +49,9 @@ import Foundation
|
|||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
checkbox.isAccessibilityElement = false
|
|
||||||
accessibilityTraits = checkbox.accessibilityTraits
|
|
||||||
accessibilityHint = checkbox.accessibilityHint
|
accessibilityHint = checkbox.accessibilityHint
|
||||||
// Update accessibility label on radio button state change.
|
accessibilityTraits = checkbox.accessibilityTraits
|
||||||
|
// Update accessibility label on checkbox state change.
|
||||||
observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in
|
observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
self?.updateAccessibilityLabel()
|
self?.updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,6 @@ import Foundation
|
|||||||
leftImage.imageView.contentMode = .scaleAspectFit
|
leftImage.imageView.contentMode = .scaleAspectFit
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -63,57 +62,37 @@ import Foundation
|
|||||||
return 140
|
return 140
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getAccessibilityMessage() -> String? {
|
||||||
|
guard let leftImageLabel = leftImage.imageView.accessibilityLabel else {
|
||||||
|
return eyebrowHeadlineBodyLink.getAccessibilityMessage()
|
||||||
|
}
|
||||||
|
guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else {
|
||||||
|
return leftImageLabel
|
||||||
|
}
|
||||||
|
return leftImageLabel + ", " + label
|
||||||
|
}
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
var message = ""
|
|
||||||
|
|
||||||
if let leftImageLabel = leftImage.accessibilityLabel {
|
|
||||||
message += leftImageLabel + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
accessibilityLabel = message
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
|
} else if let accessoryView = accessoryView {
|
||||||
|
// Both caret and link. Read all content on caret.
|
||||||
|
accessoryView.accessibilityLabel = getAccessibilityMessage()
|
||||||
|
accessibilityElements = [accessoryView, eyebrowHeadlineBodyLink.link]
|
||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
// Only link. Manually add accessibility elements to ensure they are read in the right order.
|
||||||
var elements: [UIView] = []
|
var elements: [Any] = []
|
||||||
|
if let leftImageLabel = leftImage.imageView.accessibilityLabel, !leftImageLabel.isEmpty {
|
||||||
if let leftImageLabel = leftImage.accessibilityLabel, !leftImageLabel.isEmpty {
|
elements.append(leftImage.imageView)
|
||||||
elements.append(leftImage)
|
|
||||||
}
|
}
|
||||||
|
if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() {
|
||||||
if let eyeBrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyeBrowText.isEmpty {
|
elements.append(otherElements)
|
||||||
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 {
|
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,8 +48,6 @@ import UIKit
|
|||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -78,10 +76,10 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftImageLabel = leftImage.accessibilityLabel {
|
if let leftImageLabel = leftImage.imageView.accessibilityLabel {
|
||||||
message += leftImageLabel + ", "
|
message += leftImageLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,5 +92,6 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,10 +58,8 @@ import Foundation
|
|||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.numberOfLines = 1
|
rightLabel.numberOfLines = 1
|
||||||
isAccessibilityElement = true
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -93,10 +91,10 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftImageLabel = leftImage.accessibilityLabel {
|
if let leftImageLabel = leftImage.imageView.accessibilityLabel {
|
||||||
message += leftImageLabel + ", "
|
message += leftImageLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,5 +111,6 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,6 @@ import Foundation
|
|||||||
leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
@ -76,56 +75,37 @@ import Foundation
|
|||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
func getAccessibilityMessage() -> String? {
|
||||||
|
guard let leftLabel = leftLabel.text else {
|
||||||
|
return eyebrowHeadlineBodyLink.getAccessibilityMessage()
|
||||||
|
}
|
||||||
|
guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else {
|
||||||
|
return leftLabel
|
||||||
|
}
|
||||||
|
return leftLabel + ", " + label
|
||||||
|
}
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
var message = ""
|
|
||||||
|
|
||||||
if let leftLabel = leftLabel.text {
|
|
||||||
message += leftLabel + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
accessibilityLabel = message
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
|
} else if let accessoryView = accessoryView {
|
||||||
|
// Both caret and link. Read all content on caret.
|
||||||
|
accessoryView.accessibilityLabel = getAccessibilityMessage()
|
||||||
|
accessibilityElements = [accessoryView, eyebrowHeadlineBodyLink.link]
|
||||||
} else {
|
} else {
|
||||||
var elements: [UIView] = []
|
// Only link. Manually add accessibility elements to ensure they are read in the right order.
|
||||||
|
var elements: [Any] = []
|
||||||
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
||||||
elements.append(leftLabel)
|
elements.append(leftLabel)
|
||||||
}
|
}
|
||||||
|
if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() {
|
||||||
if let eyeBrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyeBrowText.isEmpty {
|
elements.append(otherElements)
|
||||||
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 {
|
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,41 +89,19 @@ import Foundation
|
|||||||
message += radioButtonLabel + ", "
|
message += radioButtonLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
if let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() {
|
||||||
message += eyebrowLabel + ", "
|
message += label
|
||||||
}
|
|
||||||
|
|
||||||
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
|
||||||
radioButton.isAccessibilityElement = linkShowing
|
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
// Allow only radio button and link to be focused on.
|
||||||
radioButton.accessibilityLabel = message
|
radioButton.accessibilityLabel = message
|
||||||
|
accessibilityElements = [radioButton, eyebrowHeadlineBodyLink.link]
|
||||||
var elements: [UIView] = []
|
|
||||||
|
|
||||||
if !message.isEmpty {
|
|
||||||
elements.append(radioButton)
|
|
||||||
}
|
|
||||||
|
|
||||||
if linkShowing {
|
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityElements = elements
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,8 +50,8 @@ import UIKit
|
|||||||
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
|
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
|
||||||
eyebrowHeadlineBodyLink.headline.setFontStyle(.BoldBodySmall)
|
eyebrowHeadlineBodyLink.headline.setFontStyle(.BoldBodySmall)
|
||||||
|
|
||||||
accessibilityTraits = radioButton.accessibilityTraits
|
|
||||||
accessibilityHint = radioButton.accessibilityHint
|
accessibilityHint = radioButton.accessibilityHint
|
||||||
|
accessibilityTraits = radioButton.accessibilityTraits
|
||||||
|
|
||||||
// Update accessibility label on radio button state change.
|
// Update accessibility label on radio button state change.
|
||||||
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
@ -103,44 +103,23 @@ import UIKit
|
|||||||
message += radioButtonLabel + ", "
|
message += radioButtonLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let leftImageLabel = leftImage.accessibilityLabel {
|
if let leftImageLabel = leftImage.imageView.accessibilityLabel {
|
||||||
message += leftImageLabel + ", "
|
message += leftImageLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
if let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() {
|
||||||
message += eyebrowLabel + ", "
|
message += label
|
||||||
}
|
|
||||||
|
|
||||||
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
|
||||||
radioButton.isAccessibilityElement = linkShowing
|
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
// Allow only radio button and link to be focused on.
|
||||||
radioButton.accessibilityLabel = message
|
radioButton.accessibilityLabel = message
|
||||||
var elements: [UIView] = []
|
accessibilityElements = [radioButton, eyebrowHeadlineBodyLink.link]
|
||||||
|
|
||||||
if !message.isEmpty {
|
|
||||||
elements.append(radioButton)
|
|
||||||
}
|
|
||||||
|
|
||||||
if linkShowing {
|
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityElements = elements
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,9 +47,8 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
|
|
||||||
// Make the whole cell focusable.
|
// Make the whole cell focusable.
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
radioButton.isAccessibilityElement = false
|
|
||||||
accessibilityTraits = radioButton.accessibilityTraits
|
|
||||||
accessibilityHint = radioButton.accessibilityHint
|
accessibilityHint = radioButton.accessibilityHint
|
||||||
|
accessibilityTraits = radioButton.accessibilityTraits
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
|
|
||||||
// Update accessibility label on radio button state change.
|
// Update accessibility label on radio button state change.
|
||||||
|
|||||||
@ -78,8 +78,6 @@ import Foundation
|
|||||||
stack.restack()
|
stack.restack()
|
||||||
horizontalStack.restack()
|
horizontalStack.restack()
|
||||||
labelStack.restack()
|
labelStack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
@ -115,7 +113,7 @@ import Foundation
|
|||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftHeadlineText = leftHeadline.text {
|
if let leftHeadlineText = leftHeadline.text {
|
||||||
@ -135,5 +133,6 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,6 @@ import Foundation
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
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]?) {
|
||||||
@ -72,8 +71,7 @@ import Foundation
|
|||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func getAccessibilityMessage() -> String? {
|
||||||
|
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let eyebrowLabel = eyebrow.text, !eyebrowLabel.isEmpty {
|
if let eyebrowLabel = eyebrow.text, !eyebrowLabel.isEmpty {
|
||||||
@ -91,19 +89,31 @@ import Foundation
|
|||||||
if let bodyLabel = body.text, !bodyLabel.isEmpty {
|
if let bodyLabel = body.text, !bodyLabel.isEmpty {
|
||||||
message += bodyLabel
|
message += bodyLabel
|
||||||
}
|
}
|
||||||
|
return message.count > 0 ? message : nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensures voice over does not read "selected" after user triggers action on cell.
|
||||||
|
override public var accessibilityTraits: UIAccessibilityTraits {
|
||||||
|
get {
|
||||||
|
return (accessoryView != nil) ? .button : .none
|
||||||
|
}
|
||||||
|
set {}
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
let linkShowing = link.titleLabel?.text?.count ?? 0 > 0
|
let linkShowing = link.titleLabel?.text?.count ?? 0 > 0
|
||||||
isAccessibilityElement = !linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
link.isAccessibilityElement = linkShowing
|
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
accessibilityLabel = message
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
|
} else if let accessoryView = accessoryView {
|
||||||
|
// Both caret and link. Read all content on caret.
|
||||||
|
accessoryView.accessibilityLabel = getAccessibilityMessage()
|
||||||
|
accessibilityElements = [accessoryView, link]
|
||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
// Only link. Manually add accessibility elements to ensure they are read in the right order.
|
||||||
var elements: [UIView] = []
|
var elements: [Any] = []
|
||||||
|
|
||||||
|
|
||||||
if let eyeBrowText = eyebrow.text, !eyeBrowText.isEmpty {
|
if let eyeBrowText = eyebrow.text, !eyeBrowText.isEmpty {
|
||||||
elements.append(eyebrow)
|
elements.append(eyebrow)
|
||||||
}
|
}
|
||||||
@ -119,11 +129,7 @@ import Foundation
|
|||||||
if let bodyText = body.text, !bodyText.isEmpty {
|
if let bodyText = body.text, !bodyText.isEmpty {
|
||||||
elements.append(body)
|
elements.append(body)
|
||||||
}
|
}
|
||||||
|
elements.append(link)
|
||||||
if linkShowing {
|
|
||||||
elements.append(link)
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,6 @@ import Foundation
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
addMolecule(headlineBody)
|
addMolecule(headlineBody)
|
||||||
isAccessibilityElement = true
|
|
||||||
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]?){
|
||||||
@ -46,7 +44,7 @@ import Foundation
|
|||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let headlineLabel = headlineBody.headlineLabel.text {
|
if let headlineLabel = headlineBody.headlineLabel.text {
|
||||||
|
|||||||
@ -41,8 +41,6 @@ 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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -75,7 +73,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
||||||
@ -91,5 +89,6 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,9 +47,9 @@ import Foundation
|
|||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
updateAccessibilityLabel()
|
|
||||||
accessibilityValue = button.accessibilityValue
|
accessibilityValue = button.accessibilityValue
|
||||||
accessibilityHint = button.accessibilityHint
|
accessibilityHint = button.accessibilityHint
|
||||||
|
accessibilityTraits = .button
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -74,48 +74,36 @@ import Foundation
|
|||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
func getAccessibilityMessage() -> String? {
|
||||||
|
guard let buttonText = button.titleLabel?.text else {
|
||||||
|
return eyebrowHeadlineBodyLink.getAccessibilityMessage()
|
||||||
|
}
|
||||||
|
guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else {
|
||||||
|
return buttonText
|
||||||
|
}
|
||||||
|
return label + ", " + buttonText
|
||||||
|
}
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
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 buttonLabel = button.accessibilityLabel {
|
|
||||||
message += buttonLabel
|
|
||||||
}
|
|
||||||
|
|
||||||
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
|
if !linkShowing && accessoryView == nil {
|
||||||
isAccessibilityElement = !linkShowing
|
// Make whole cell focusable if one action
|
||||||
button.isAccessibilityElement = linkShowing
|
isAccessibilityElement = true
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
|
|
||||||
if !linkShowing {
|
|
||||||
// Make whole cell focusable if no link.
|
|
||||||
accessibilityLabel = message
|
|
||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
// Make buttons focusable.
|
||||||
button.accessibilityLabel = message
|
isAccessibilityElement = false
|
||||||
var elements: [UIView] = []
|
var elements: [Any] = []
|
||||||
|
if let accessoryView = accessoryView {
|
||||||
if !message.isEmpty {
|
accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage()
|
||||||
elements.append(button)
|
elements.append(accessoryView)
|
||||||
|
} else {
|
||||||
|
button.accessibilityLabel = getAccessibilityMessage()
|
||||||
}
|
}
|
||||||
|
elements.append(button)
|
||||||
if linkShowing {
|
if linkShowing {
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,8 +40,6 @@ import Foundation
|
|||||||
rightImage.addSizeConstraintsForAspectRatio = true
|
rightImage.addSizeConstraintsForAspectRatio = true
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
@ -72,17 +70,18 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
||||||
message += leftLabelText + ", "
|
message += leftLabelText + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let rightImageText = rightImage.accessibilityLabel, !rightImageText.isEmpty {
|
if let rightImageText = rightImage.imageView.accessibilityLabel, !rightImageText.isEmpty {
|
||||||
message += rightImageText
|
message += rightImageText
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,6 @@ import Foundation
|
|||||||
arrow.pinHeightAndWidth()
|
arrow.pinHeightAndWidth()
|
||||||
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]?) {
|
||||||
@ -89,57 +88,36 @@ import Foundation
|
|||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func getAccessibilityMessage() -> String? {
|
||||||
|
guard let rightLabelText = rightLabel.text else {
|
||||||
|
return eyebrowHeadlineBodyLink.getAccessibilityMessage()
|
||||||
|
}
|
||||||
|
guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else {
|
||||||
|
return rightLabelText
|
||||||
|
}
|
||||||
|
return label + ", " + rightLabelText
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
isAccessibilityElement = !linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
var message = ""
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
|
} else if let accessoryView = accessoryView {
|
||||||
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
// Both caret and link. Read all content on caret.
|
||||||
message += eyebrowLabel + ", "
|
accessoryView.accessibilityLabel = getAccessibilityMessage()
|
||||||
}
|
accessibilityElements = [accessoryView, eyebrowHeadlineBodyLink.link]
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var elements: [UIView] = []
|
// Only link. Manually add accessibility elements to ensure they are read in the right order.
|
||||||
|
var elements: [Any] = []
|
||||||
if let eyebrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyebrowText.isEmpty {
|
if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() {
|
||||||
elements.append(eyebrowHeadlineBodyLink.eyebrow)
|
elements.append(otherElements)
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty {
|
if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty {
|
||||||
elements.append(rightLabel)
|
elements.append(rightLabel)
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,8 +54,6 @@ import Foundation
|
|||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
arrowAndRightLabelStack.restack()
|
arrowAndRightLabelStack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -87,7 +85,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let headlineText = headlineBody.headlineLabel.text, !headlineText.isEmpty {
|
if let headlineText = headlineBody.headlineLabel.text, !headlineText.isEmpty {
|
||||||
@ -103,5 +101,6 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,6 @@ import Foundation
|
|||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -72,48 +71,37 @@ import Foundation
|
|||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
func getAccessibilityMessage() -> String? {
|
||||||
|
guard let linkText = link.titleLabel?.text else {
|
||||||
|
return eyebrowHeadlineBodyLink.getAccessibilityMessage()
|
||||||
|
}
|
||||||
|
guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else {
|
||||||
|
return linkText
|
||||||
|
}
|
||||||
|
return label + ", " + linkText
|
||||||
|
}
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
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
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
|
accessibilityTraits = .button
|
||||||
isAccessibilityElement = !linkShowing
|
if !linkShowing && accessoryView == nil {
|
||||||
link.isAccessibilityElement = linkShowing
|
// Make whole cell focusable if one action
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
isAccessibilityElement = true
|
||||||
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
if !linkShowing {
|
|
||||||
// Make whole cell focusable if no link.
|
|
||||||
accessibilityLabel = message
|
|
||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
// Make buttons focusable.
|
||||||
link.accessibilityLabel = message
|
isAccessibilityElement = false
|
||||||
var elements: [UIView] = []
|
var elements: [Any] = []
|
||||||
|
if let accessoryView = accessoryView {
|
||||||
|
accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage()
|
||||||
|
elements.append(accessoryView)
|
||||||
|
} else {
|
||||||
|
link.accessibilityLabel = getAccessibilityMessage()
|
||||||
|
}
|
||||||
|
elements.append(link)
|
||||||
if linkShowing {
|
if linkShowing {
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !message.isEmpty {
|
|
||||||
elements.append(link)
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,8 +51,6 @@ 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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -86,7 +84,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
||||||
@ -98,5 +96,6 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
|
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,8 +42,6 @@ import Foundation
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -77,7 +75,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftText = leftLabel.text, !leftText.isEmpty {
|
if let leftText = leftLabel.text, !leftText.isEmpty {
|
||||||
|
|||||||
@ -55,8 +55,6 @@ import Foundation
|
|||||||
arrow.pinHeightAndWidth()
|
arrow.pinHeightAndWidth()
|
||||||
arrowAndLabel2Stack.restack()
|
arrowAndLabel2Stack.restack()
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
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]?) {
|
||||||
@ -87,7 +85,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftText = leftLabel.text, !leftText.isEmpty {
|
if let leftText = leftLabel.text, !leftText.isEmpty {
|
||||||
|
|||||||
@ -54,7 +54,6 @@ import Foundation
|
|||||||
((molecule as? StackItem)?.view as? Stack<StackModel>)?.restack()
|
((molecule as? StackItem)?.view as? Stack<StackModel>)?.restack()
|
||||||
}
|
}
|
||||||
containingStack.restack()
|
containingStack.restack()
|
||||||
isAccessibilityElement = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|||||||
@ -67,9 +67,6 @@ import Foundation
|
|||||||
leftHeadline.numberOfLines = 1
|
leftHeadline.numberOfLines = 1
|
||||||
rightLabel.numberOfLines = 1
|
rightLabel.numberOfLines = 1
|
||||||
rightSubLabel.numberOfLines = 1
|
rightSubLabel.numberOfLines = 1
|
||||||
|
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
@ -107,7 +104,7 @@ import Foundation
|
|||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftHeadline = leftHeadline.text, !leftHeadline.isEmpty {
|
if let leftHeadline = leftHeadline.text, !leftHeadline.isEmpty {
|
||||||
|
|||||||
@ -31,8 +31,6 @@ import UIKit
|
|||||||
containerHelper.constrainView(view)
|
containerHelper.constrainView(view)
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
rightLabel.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
@ -72,7 +70,7 @@ import UIKit
|
|||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
isAccessibilityElement = true
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
if let leftLabel = leftLabel.text, !leftLabel.isEmpty {
|
if let leftLabel = leftLabel.text, !leftLabel.isEmpty {
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
|
|||||||
public var tintColor: Color
|
public var tintColor: Color
|
||||||
public var line: LineModel?
|
public var line: LineModel?
|
||||||
public var alwaysShowBackButton = false
|
public var alwaysShowBackButton = false
|
||||||
public var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? = NavigationImageButtonModel(with: "back", action: ActionBackModel())
|
public var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? = NavigationImageButtonModel(with: "nav_back", action: ActionBackModel())
|
||||||
public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
||||||
public var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
public var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
|
|||||||
hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) ?? false
|
hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) ?? false
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white)
|
||||||
tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black)
|
tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black)
|
||||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) ?? LineModel(type: .standard)
|
||||||
alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) ?? false
|
alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) ?? false
|
||||||
if let backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol) = try typeContainer.decodeModelIfPresent(codingKey: .backButton) {
|
if let backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol) = try typeContainer.decodeModelIfPresent(codingKey: .backButton) {
|
||||||
self.backButton = backButton
|
self.backButton = backButton
|
||||||
|
|||||||
@ -69,4 +69,44 @@ import UIKit
|
|||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 65
|
return 65
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Accessibility Helpers
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
/// Returns the labels text in one message.
|
||||||
|
func getAccessibilityMessage() -> String? {
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let eyebrowLabel = eyebrow.text {
|
||||||
|
message += eyebrowLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = headline.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyLabel = body.text {
|
||||||
|
message += bodyLabel
|
||||||
|
}
|
||||||
|
return message.count > 0 ? message : nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns an array of the appropriate accessibility elements.
|
||||||
|
func getAccessibilityElements() -> [Any]? {
|
||||||
|
var elements: [UIView] = []
|
||||||
|
if eyebrow.hasText {
|
||||||
|
elements.append(eyebrow)
|
||||||
|
}
|
||||||
|
if headline.hasText {
|
||||||
|
elements.append(headline)
|
||||||
|
}
|
||||||
|
if body.hasText {
|
||||||
|
elements.append(body)
|
||||||
|
}
|
||||||
|
if link.titleLabel?.text?.count ?? 0 > 0 {
|
||||||
|
elements.append(link)
|
||||||
|
}
|
||||||
|
return elements.count > 0 ? elements : nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,8 +73,8 @@ open class ThreeHeadlineBodyLink: View {
|
|||||||
bottomAnchor.constraint(equalTo: link.bottomAnchor).isActive = true
|
bottomAnchor.constraint(equalTo: link.bottomAnchor).isActive = true
|
||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = link.accessibilityTraits
|
|
||||||
accessibilityHint = link.accessibilityHint
|
accessibilityHint = link.accessibilityHint
|
||||||
|
accessibilityTraits = link.accessibilityTraits
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -205,8 +205,8 @@ import UIKit
|
|||||||
let caret = CaretView(lineWidth: 1)
|
let caret = CaretView(lineWidth: 1)
|
||||||
caret.translatesAutoresizingMaskIntoConstraints = true
|
caret.translatesAutoresizingMaskIntoConstraints = true
|
||||||
caret.isAccessibilityElement = true
|
caret.isAccessibilityElement = true
|
||||||
caret.accessibilityTraits = .button
|
|
||||||
caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
||||||
|
caret.accessibilityTraits = .button
|
||||||
caret.size = .small(.vertical)
|
caret.size = .small(.vertical)
|
||||||
if let size = caret.size?.dimensions() {
|
if let size = caret.size?.dimensions() {
|
||||||
caret.frame = CGRect(origin: CGPoint.zero, size: size)
|
caret.frame = CGRect(origin: CGPoint.zero, size: size)
|
||||||
|
|||||||
@ -163,9 +163,6 @@ import UIKit
|
|||||||
open func createDefaultLegacyNavigationModel() -> NavigationItemModel {
|
open func createDefaultLegacyNavigationModel() -> NavigationItemModel {
|
||||||
let navigationModel = NavigationItemModel()
|
let navigationModel = NavigationItemModel()
|
||||||
navigationModel.title = pageModel?.screenHeading
|
navigationModel.title = pageModel?.screenHeading
|
||||||
if /*(self as? MVMCoreUITabBarPageControlViewController) != nil ||*/ manager != nil || loadObject?.requestParameters?.tabWasPressed ?? false == true {
|
|
||||||
navigationModel.line = LineModel(type: .none)
|
|
||||||
}
|
|
||||||
return navigationModel
|
return navigationModel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -146,7 +146,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (nullable UIImage *)imageForBackButton {
|
- (nullable UIImage *)imageForBackButton {
|
||||||
return [MVMCoreUIUtility imageNamed:@"back"];
|
return [MVMCoreUIUtility imageNamed:@"nav_back"];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Button Presses
|
#pragma mark - Button Presses
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user