Merge branch 'bugfix/CXTDT-446531' into 'develop'
Updated accessibility behavior for TextEntryField, BaseItemPickerEntryField, checkBoxLabel ### Summary 1. Textfield : VO should reads as label, textField. 2. Picker : VO should read as label, current selection , has popup/ picker item. 3. CheckBox Label : Both checkbox and label should have single focus, VO should read as checkbox role, status and label. ### JIRA Ticket https://onejira.verizon.com/browse/CXTDT-446531 This PR is having dependency with https://gitlab.verizon.com/BPHV_MIPS/mobilefirst_ios/-/merge_requests/2263. Unable to add dependency in this PR. Co-authored-by: Keerthy <keerthy.marakanti@verizon.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1020
This commit is contained in:
commit
c202a93acf
@ -75,11 +75,8 @@ extension BaseItemPickerEntryField {
|
||||
@objc open override func setAccessibilityString(_ accessibilityString: String?) {
|
||||
|
||||
var accessibilityString = accessibilityString ?? ""
|
||||
|
||||
if let textPickerItem = MVMCoreUIUtility.hardcodedString(withKey: "textfield_picker_item") {
|
||||
accessibilityString += textPickerItem
|
||||
}
|
||||
|
||||
textField.accessibilityTraits = .staticText
|
||||
textField.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "textfield_picker_item")
|
||||
textField.accessibilityLabel = "\(accessibilityString) \(textField.isEnabled ? "" : MVMCoreUIUtility.hardcodedString(withKey: "textfield_disabled_state") ?? "")"
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ import UIKit
|
||||
if let text = model.text, !text.isEmpty {
|
||||
regexTextFieldOutputIfAvailable()
|
||||
}
|
||||
|
||||
setAccessibilityString(model.title ?? "")
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,10 +399,6 @@ extension TextEntryField {
|
||||
|
||||
var accessibilityString = accessibilityString ?? ""
|
||||
|
||||
if let txtRegular = MVMCoreUIUtility.hardcodedString(withKey: "textfield_regular") {
|
||||
accessibilityString += txtRegular
|
||||
}
|
||||
|
||||
textField.accessibilityLabel = "\(accessibilityString) \(textField.isEnabled ? "" : MVMCoreUIUtility.hardcodedString(withKey: "textfield_disabled_state") ?? "")"
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
|
||||
public let checkbox = Checkbox()
|
||||
public let label = Label(fontStyle: .RegularBodySmall)
|
||||
private var observation: NSKeyValueObservation? = nil
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
@ -63,6 +64,12 @@
|
||||
bottomLabelConstraint.isActive = true
|
||||
|
||||
alignCheckbox(.center)
|
||||
isAccessibilityElement = true
|
||||
accessibilityHint = checkbox.accessibilityHint
|
||||
accessibilityTraits = checkbox.accessibilityTraits
|
||||
observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in
|
||||
self?.updateAccessibilityLabel()
|
||||
}
|
||||
}
|
||||
|
||||
@objc override open func updateView(_ size: CGFloat) {
|
||||
@ -111,6 +118,7 @@
|
||||
|
||||
checkbox.set(with: checkBoxWithLabelModel.checkbox, delegateObject, additionalData)
|
||||
label.set(with: checkBoxWithLabelModel.label, delegateObject, additionalData)
|
||||
updateAccessibilityLabel()
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
@ -124,4 +132,13 @@
|
||||
checkbox.reset()
|
||||
alignCheckbox(.center)
|
||||
}
|
||||
|
||||
override open func accessibilityActivate() -> Bool {
|
||||
checkbox.accessibilityActivate()
|
||||
}
|
||||
|
||||
open func updateAccessibilityLabel() {
|
||||
checkbox.updateAccessibilityLabel()
|
||||
accessibilityLabel = [checkbox.accessibilityLabel, label.text].compactMap { $0 }.joined(separator: ",")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user