changes for accessibility and formatting
This commit is contained in:
parent
a37c0ba761
commit
313cab70b3
@ -20,7 +20,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override var isSelected: Bool {
|
@objc public override var isSelected: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
radioModel?.state = isSelected
|
radioModel?.state = isSelected
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
|
|||||||
@ -14,11 +14,13 @@ import UIKit
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
let radioButton = RadioButton(frame: .zero)
|
let radioButton = RadioButton()
|
||||||
let leftImage = LoadImageView(pinnedEdges: .all)
|
let leftImage = LoadImageView(pinnedEdges: .all)
|
||||||
let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||||
var stack: Stack<StackModel>
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
private var observation: NSKeyValueObservation? = nil
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -46,11 +48,16 @@ import UIKit
|
|||||||
stack.restack()
|
stack.restack()
|
||||||
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
|
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
|
||||||
eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true)
|
eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true)
|
||||||
|
radioButton.isAccessibilityElement = false
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
accessibilityTraits = .button
|
accessibilityTraits = .button
|
||||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
|
||||||
|
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
|
self?.updateAccessibilityLabel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
@ -69,7 +76,6 @@ import UIKit
|
|||||||
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
||||||
leftImage.set(with: model.image, delegateObject, additionalData)
|
leftImage.set(with: model.image, 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? {
|
||||||
|
|||||||
@ -18,6 +18,8 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
let headlineBody = HeadlineBody()
|
let headlineBody = HeadlineBody()
|
||||||
var stack: Stack<StackModel>
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
private var observation: NSKeyValueObservation? = nil
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -43,9 +45,14 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
updateAccessibilityLabel()
|
radioButton.isAccessibilityElement = false
|
||||||
accessibilityTraits = .button
|
accessibilityTraits = .button
|
||||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
|
||||||
|
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
|
self?.updateAccessibilityLabel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
@ -59,7 +66,6 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
|
|
||||||
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
||||||
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, 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? {
|
||||||
@ -68,7 +74,6 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
|
|
||||||
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
radioButton.tapAction()
|
radioButton.tapAction()
|
||||||
updateAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
|||||||
@ -21,12 +21,10 @@ public protocol MoleculeListCellProtocol: UITableViewCell {
|
|||||||
|
|
||||||
// Default implementation does nothing
|
// Default implementation does nothing
|
||||||
extension MoleculeListCellProtocol {
|
extension MoleculeListCellProtocol {
|
||||||
public func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath) { }
|
||||||
}
|
|
||||||
|
public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { }
|
||||||
func willDisplay() {
|
|
||||||
}
|
func willDisplay() { }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user