Addressed code review comments
This commit is contained in:
parent
459d3e4a33
commit
d1ee6e7f3a
@ -161,7 +161,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
bottomConstraint?.isActive = true
|
bottomConstraint?.isActive = true
|
||||||
|
|
||||||
heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0)
|
heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0)
|
||||||
accessibilityElements = [titleLabel, textView, feedbackLabel]
|
accessibilityElements = [textView]
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
@ -281,11 +281,25 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
if model.hideBorders {
|
if model.hideBorders {
|
||||||
adjustMarginConstraints(constant: 0)
|
adjustMarginConstraints(constant: 0)
|
||||||
}
|
}
|
||||||
setAccessibilityString(model.title)
|
updateAccessibility(model: model)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func setAccessibilityString(_ accessibilityString: String?) {
|
func updateAccessibility(model: TextViewEntryFieldModel) {
|
||||||
let accessibilityString = accessibilityString ?? ""
|
|
||||||
textView.accessibilityLabel = "\(String(describing: accessibilityString)) \(self.textView.isEnabled ? "" : MVMCoreUIUtility.hardcodedString(withKey: "textfield_disabled_state") ?? "")"
|
var message = ""
|
||||||
|
|
||||||
|
if let titleText = model.accessibilityText ?? model.title {
|
||||||
|
message += "\(titleText) \( model.enabled ? String(format: (MVMCoreUIUtility.hardcodedString(withKey: "textfield_optional")) ?? "") : "" ) \(self.textView.isEnabled ? "" : MVMCoreUIUtility.hardcodedString(withKey: "textfield_disabled_state") ?? "")"
|
||||||
|
}
|
||||||
|
|
||||||
|
if let feedback = model.feedback {
|
||||||
|
message += ", " + feedback
|
||||||
|
}
|
||||||
|
|
||||||
|
if let errorMessage = errorLabel.text {
|
||||||
|
message += ", " + errorMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
textView.accessibilityLabel = message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user