diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift index 3221f043..46e4e233 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift @@ -161,7 +161,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele bottomConstraint?.isActive = true heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0) - accessibilityElements = [titleLabel, textView, feedbackLabel] + accessibilityElements = [textView] } open override func updateView(_ size: CGFloat) { @@ -281,6 +281,25 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele if model.hideBorders { adjustMarginConstraints(constant: 0) } + updateAccessibility(model: model) + } + + func updateAccessibility(model: TextViewEntryFieldModel) { + 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 } } diff --git a/MVMCoreUI/BaseClasses/TextView.swift b/MVMCoreUI/BaseClasses/TextView.swift index 8d09ca35..5e4f1c07 100644 --- a/MVMCoreUI/BaseClasses/TextView.swift +++ b/MVMCoreUI/BaseClasses/TextView.swift @@ -98,7 +98,6 @@ import UIKit smartInsertDeleteType = .no inputAccessoryView = nil isAccessibilityElement = true - accessibilityTraits = .staticText font = fontStyle.getFont() keyboardType = .default isEditable = true diff --git a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings index c5b9478e..b42f7d92 100644 --- a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings @@ -27,6 +27,7 @@ // MARK: Textfield "textfield_today_string" = "Today"; "textfield_error_message" = "%@.\n The error message.\n %@"; +"textView_error_message" = "%@.\n The error message.\n %@"; "textfield_picker_item" = " picker item"; "textfield_regular" = " regular"; "textfield_disabled_state" = "disabled"; diff --git a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings index b68dd624..589c4f9a 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings @@ -23,6 +23,7 @@ // Textfield "textfield_today_string" = "Hoy"; "textfield_error_message" = "%@.\n El mensaje de error.\n %@"; +"textView_error_message" = "%@.\n El mensaje de error.\n %@"; "textfield_picker_item" = " artículo de selector"; "textfield_regular" = " regular"; "textfield_disabled_state" = "inactivo"; diff --git a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings index 7eb53fa7..24a6d8db 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings @@ -23,6 +23,7 @@ // Textfield "textfield_today_string" = "Hoy"; "textfield_error_message" = "%@.\n El mensaje de error.\n %@"; +"textView_error_message" = "%@.\n El mensaje de error.\n %@"; "textfield_picker_item" = " artículo de selector"; "textfield_regular" = " regular"; "textfield_disabled_state" = "inactivo";