ensure all classes accessibility works the same
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
8cc87fd471
commit
2163abe91a
@ -144,6 +144,18 @@ open class DatePicker: EntryFieldBase, DatePickerViewControllerDelegate, UIPopov
|
||||
selectedDateLabel.isEnabled = isEnabled
|
||||
calendarIcon.color = iconColorConfiguration.getColor(self)
|
||||
}
|
||||
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
let label = "Date Picker, \(isReadOnly ? ", read only" : "")"
|
||||
if let errorText, showError {
|
||||
fieldStackView.accessibilityLabel = "\(label) ,error, \(errorText)"
|
||||
} else {
|
||||
fieldStackView.accessibilityLabel = label
|
||||
}
|
||||
fieldStackView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
|
||||
fieldStackView.accessibilityValue = value
|
||||
}
|
||||
|
||||
/// Resets to default settings.
|
||||
open override func reset() {
|
||||
|
||||
@ -132,7 +132,6 @@ open class DropdownSelect: EntryFieldBase {
|
||||
super.setup()
|
||||
|
||||
fieldStackView.isAccessibilityElement = true
|
||||
fieldStackView.accessibilityLabel = "Dropdown Select"
|
||||
inlineDisplayLabel.isAccessibilityElement = true
|
||||
|
||||
dropdownField.width(0)
|
||||
@ -278,9 +277,14 @@ open class DropdownSelect: EntryFieldBase {
|
||||
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
let selectedOption = selectedOptionLabel.text ?? ""
|
||||
fieldStackView.accessibilityLabel = "Dropdown Select, \(selectedOption) \(isReadOnly ? ", read only" : "")"
|
||||
let label = "Dropdown Select, \(isReadOnly ? ", read only" : "")"
|
||||
if let errorText, showError {
|
||||
fieldStackView.accessibilityLabel = "\(label) ,error, \(errorText)"
|
||||
} else {
|
||||
fieldStackView.accessibilityLabel = label
|
||||
}
|
||||
fieldStackView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
|
||||
fieldStackView.accessibilityValue = value
|
||||
}
|
||||
|
||||
open override var accessibilityElements: [Any]? {
|
||||
|
||||
@ -90,7 +90,6 @@ open class InputField: EntryFieldBase {
|
||||
open var textField = TextField().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
$0.font = TextStyle.bodyLarge.font
|
||||
$0.isAccessibilityElement = true
|
||||
}
|
||||
|
||||
/// Color configuration for the textField.
|
||||
@ -211,9 +210,21 @@ open class InputField: EntryFieldBase {
|
||||
super.updateView()
|
||||
|
||||
textField.isEnabled = isEnabled
|
||||
textField.isUserInteractionEnabled = isEnabled && !isReadOnly
|
||||
textField.textColor = textFieldTextColorConfiguration.getColor(self)
|
||||
}
|
||||
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
let label = "\(isReadOnly ? "read only" : "")"
|
||||
if let errorText, showError {
|
||||
textField.accessibilityLabel = "\(label) ,error, \(errorText)"
|
||||
} else {
|
||||
textField.accessibilityLabel = label
|
||||
}
|
||||
textField.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
|
||||
}
|
||||
|
||||
open override func updateErrorLabel() {
|
||||
super.updateErrorLabel()
|
||||
|
||||
@ -234,19 +245,12 @@ open class InputField: EntryFieldBase {
|
||||
} else {
|
||||
successLabel.isHidden = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override func updateRules() {
|
||||
super.updateRules()
|
||||
fieldType.handler().appendRules(self)
|
||||
}
|
||||
|
||||
/// Used to update any Accessibility properties.
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
textField.accessibilityLabel = showError ? "error" : nil
|
||||
}
|
||||
|
||||
open override var accessibilityElements: [Any]? {
|
||||
get {
|
||||
|
||||
@ -109,7 +109,6 @@ open class TextArea: EntryFieldBase {
|
||||
$0.isScrollEnabled = false
|
||||
$0.textContainerInset = .zero
|
||||
$0.textContainer.lineFragmentPadding = 0
|
||||
$0.isAccessibilityElement = true
|
||||
}
|
||||
|
||||
open var maxLength: Int? {
|
||||
@ -194,13 +193,24 @@ open class TextArea: EntryFieldBase {
|
||||
|
||||
statusIcon.color = iconColorConfiguration.getColor(self)
|
||||
containerView.layer.borderColor = isReadOnly ? readOnlyBorderColorConfiguration.getColor(self).cgColor : borderColorConfiguration.getColor(self).cgColor
|
||||
textView.isEditable = isReadOnly ? false : true
|
||||
textView.isEditable = !isEnabled || isReadOnly ? false : true
|
||||
textView.backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||
textView.tintColor = iconColorConfiguration.getColor(self)
|
||||
characterCounterLabel.surface = surface
|
||||
highlightCharacterOverflow()
|
||||
}
|
||||
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
let label = "\(isReadOnly ? "read only" : "")"
|
||||
if let errorText, showError {
|
||||
textView.accessibilityLabel = "\(label) ,error, \(errorText)"
|
||||
} else {
|
||||
textView.accessibilityLabel = label
|
||||
}
|
||||
textView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
|
||||
}
|
||||
|
||||
override func updateRules() {
|
||||
super.updateRules()
|
||||
|
||||
@ -224,13 +234,7 @@ open class TextArea: EntryFieldBase {
|
||||
stackView.addArrangedSubview(characterCounterLabel)
|
||||
return stackView
|
||||
}
|
||||
|
||||
/// Used to update any Accessibility properties.
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
textView.accessibilityLabel = showError ? "error" : nil
|
||||
}
|
||||
|
||||
|
||||
open override var accessibilityElements: [Any]? {
|
||||
get {
|
||||
var elements = [Any]()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user