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 {
|
||||
radioModel?.state = isSelected
|
||||
updateAccessibilityLabel()
|
||||
|
||||
@ -14,11 +14,13 @@ import UIKit
|
||||
// MARK: - Outlets
|
||||
//-----------------------------------------------------
|
||||
|
||||
let radioButton = RadioButton(frame: .zero)
|
||||
let radioButton = RadioButton()
|
||||
let leftImage = LoadImageView(pinnedEdges: .all)
|
||||
let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||
var stack: Stack<StackModel>
|
||||
|
||||
private var observation: NSKeyValueObservation? = nil
|
||||
|
||||
//-----------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//-----------------------------------------------------
|
||||
@ -46,11 +48,16 @@ import UIKit
|
||||
stack.restack()
|
||||
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
|
||||
eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true)
|
||||
|
||||
radioButton.isAccessibilityElement = false
|
||||
isAccessibilityElement = true
|
||||
updateAccessibilityLabel()
|
||||
accessibilityTraits = .button
|
||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||
updateAccessibilityLabel()
|
||||
|
||||
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
||||
self?.updateAccessibilityLabel()
|
||||
}
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
@ -69,7 +76,6 @@ import UIKit
|
||||
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
||||
leftImage.set(with: model.image, delegateObject, additionalData)
|
||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||
updateAccessibilityLabel()
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
|
||||
@ -18,6 +18,8 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
||||
let headlineBody = HeadlineBody()
|
||||
var stack: Stack<StackModel>
|
||||
|
||||
private var observation: NSKeyValueObservation? = nil
|
||||
|
||||
//-----------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//-----------------------------------------------------
|
||||
@ -43,9 +45,14 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
isAccessibilityElement = true
|
||||
updateAccessibilityLabel()
|
||||
radioButton.isAccessibilityElement = false
|
||||
accessibilityTraits = .button
|
||||
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)
|
||||
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||
updateAccessibilityLabel()
|
||||
}
|
||||
|
||||
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]?) {
|
||||
radioButton.tapAction()
|
||||
updateAccessibilityLabel()
|
||||
}
|
||||
|
||||
func updateAccessibilityLabel() {
|
||||
|
||||
@ -21,12 +21,10 @@ public protocol MoleculeListCellProtocol: UITableViewCell {
|
||||
|
||||
// Default implementation does nothing
|
||||
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]?) {
|
||||
}
|
||||
|
||||
func willDisplay() {
|
||||
}
|
||||
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() { }
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user