CXTDT-560823 – TextArea – Accessibility Labels/Error/ReadyOnly/Disabled.

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-06-05 15:18:32 -05:00
parent a7524e6318
commit 40a31dfe25
6 changed files with 23 additions and 25 deletions

View File

@ -147,12 +147,7 @@ open class DatePicker: EntryFieldBase, DatePickerViewControllerDelegate, UIPopov
open override func updateAccessibility() { open override func updateAccessibility() {
super.updateAccessibility() super.updateAccessibility()
let label = "Date Picker, \(isReadOnly ? ", read only" : "")" fieldStackView.accessibilityLabel = "Date Picker, \(accessibilityLabelText)"
if let errorText, showError {
fieldStackView.accessibilityLabel = "\(label) ,error, \(errorText)"
} else {
fieldStackView.accessibilityLabel = label
}
fieldStackView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open." fieldStackView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
fieldStackView.accessibilityValue = value fieldStackView.accessibilityValue = value
} }

View File

@ -278,12 +278,7 @@ open class DropdownSelect: EntryFieldBase {
open override func updateAccessibility() { open override func updateAccessibility() {
super.updateAccessibility() super.updateAccessibility()
let label = "Dropdown Select, \(isReadOnly ? ", read only" : "")" fieldStackView.accessibilityLabel = "Dropdown Select, \(accessibilityLabelText)"
if let errorText, showError {
fieldStackView.accessibilityLabel = "\(label) ,error, \(errorText)"
} else {
fieldStackView.accessibilityLabel = label
}
fieldStackView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open." fieldStackView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
fieldStackView.accessibilityValue = value fieldStackView.accessibilityValue = value
} }

View File

@ -241,6 +241,23 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
open var rules = [AnyRule<String>]() open var rules = [AnyRule<String>]()
open var accessibilityLabelText: String {
var accessibilityLabels = [String]()
if let text = titleLabel.text {
accessibilityLabels.append(text)
}
if isReadOnly {
accessibilityLabels.append("read only")
}
if !isEnabled {
accessibilityLabels.append("dimmed")
}
if let errorText, showError {
accessibilityLabels.append("error, \(errorText)")
}
return accessibilityLabels.joined(separator: ", ")
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------

View File

@ -225,15 +225,10 @@ open class InputField: EntryFieldBase {
textField.isUserInteractionEnabled = isEnabled && !isReadOnly textField.isUserInteractionEnabled = isEnabled && !isReadOnly
textField.textColor = textFieldTextColorConfiguration.getColor(self) textField.textColor = textFieldTextColorConfiguration.getColor(self)
} }
open override func updateAccessibility() { open override func updateAccessibility() {
super.updateAccessibility() super.updateAccessibility()
let label = "\(isReadOnly ? "read only" : "")" textField.accessibilityLabel = accessibilityLabelText
if let errorText, showError {
textField.accessibilityLabel = "\(label) ,error, \(errorText)"
} else {
textField.accessibilityLabel = label
}
textField.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open." textField.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
} }

View File

@ -195,12 +195,7 @@ open class TextArea: EntryFieldBase {
open override func updateAccessibility() { open override func updateAccessibility() {
super.updateAccessibility() super.updateAccessibility()
let label = "\(isReadOnly ? "read only" : "")" textView.accessibilityLabel = accessibilityLabelText
if let errorText, showError {
textView.accessibilityLabel = "\(label) ,error, \(errorText)"
} else {
textView.accessibilityLabel = label
}
textView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open." textView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
} }

View File

@ -3,6 +3,7 @@
- CXTDT-565087 - Input Field - Text - OnDark colors - CXTDT-565087 - Input Field - Text - OnDark colors
- CXTDT-565112 - Input Field - Credit Card icons - CXTDT-565112 - Input Field - Credit Card icons
- CXTDT-565117 - Input Field - Overflow not clipped - CXTDT-565117 - Input Field - Overflow not clipped
- CXTDT-560823 TextArea Accessibility Labels/Error/ReadyOnly/Disabled
1.0.65 1.0.65
---------------- ----------------