changes for accessibility
This commit is contained in:
parent
8ba1e65f0b
commit
b77c7c79e4
@ -102,7 +102,7 @@ import Foundation
|
|||||||
|
|
||||||
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
|
|
||||||
isAccessibilityElement = true//!linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
checkbox.isAccessibilityElement = linkShowing
|
checkbox.isAccessibilityElement = linkShowing
|
||||||
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
||||||
|
|
||||||
@ -118,11 +118,20 @@ import Foundation
|
|||||||
elements.append(checkbox)
|
elements.append(checkbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
if eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 {
|
if linkShowing {
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override open func accessibilityActivate() -> Bool {
|
||||||
|
|
||||||
|
if isAccessibilityElement {
|
||||||
|
return checkbox.accessibilityActivate()
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,6 @@ import Foundation
|
|||||||
leftImage.imageView.contentMode = .scaleAspectFit
|
leftImage.imageView.contentMode = .scaleAspectFit
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +92,22 @@ import Foundation
|
|||||||
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.
|
||||||
accessibilityLabel = message
|
|
||||||
var elements: [UIView] = []
|
var elements: [UIView] = []
|
||||||
|
|
||||||
if message.count > 0 {
|
if let leftImageLabel = leftImage.accessibilityLabel, !leftImageLabel.isEmpty {
|
||||||
elements.append(self)
|
elements.append(leftImage)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let eyeBrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyeBrowText.isEmpty {
|
||||||
|
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 {
|
||||||
|
|||||||
@ -45,6 +45,7 @@ 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()
|
updateAccessibilityLabel()
|
||||||
|
|||||||
@ -46,7 +46,6 @@ import Foundation
|
|||||||
leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,13 +106,22 @@ import Foundation
|
|||||||
// 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.
|
|
||||||
accessibilityLabel = message
|
|
||||||
|
|
||||||
var elements: [UIView] = []
|
var elements: [UIView] = []
|
||||||
|
|
||||||
if message.count > 0 {
|
if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty {
|
||||||
elements.append(self)
|
elements.append(leftLabel)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let eyeBrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyeBrowText.isEmpty {
|
||||||
|
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 {
|
||||||
|
|||||||
@ -109,7 +109,7 @@ import Foundation
|
|||||||
|
|
||||||
var elements: [UIView] = []
|
var elements: [UIView] = []
|
||||||
|
|
||||||
if message.count > 0 {
|
if !message.isEmpty {
|
||||||
elements.append(radioButton)
|
elements.append(radioButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user