first cut of accessibility update
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
0f27e82987
commit
9871324c8e
@ -100,16 +100,14 @@ open class DatePicker: EntryFieldBase, DatePickerViewControllerDelegate, UIPopov
|
||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
fieldStackView.isAccessibilityElement = true
|
||||
fieldStackView.accessibilityLabel = "Date Picker"
|
||||
fieldStackView.accessibilityHint = "Double Tap to open"
|
||||
|
||||
containerView.isAccessibilityElement = true
|
||||
|
||||
// setting color config
|
||||
selectedDateLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
||||
|
||||
// tap gesture
|
||||
fieldStackView
|
||||
containerView
|
||||
.publisher(for: UITapGestureRecognizer())
|
||||
.sink { [weak self] _ in
|
||||
guard let self else { return }
|
||||
@ -147,9 +145,31 @@ open class DatePicker: EntryFieldBase, DatePickerViewControllerDelegate, UIPopov
|
||||
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
fieldStackView.accessibilityLabel = "Date Picker, \(accessibilityLabelText)"
|
||||
fieldStackView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
|
||||
fieldStackView.accessibilityValue = value
|
||||
containerView.accessibilityLabel = "Date Picker, \(accessibilityLabelText)"
|
||||
containerView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
|
||||
containerView.accessibilityValue = value
|
||||
}
|
||||
|
||||
open override var accessibilityElements: [Any]? {
|
||||
get {
|
||||
var elements = [Any]()
|
||||
elements.append(contentsOf: [titleLabel, containerView])
|
||||
|
||||
if showError {
|
||||
elements.append(statusIcon)
|
||||
if let errorText, !errorText.isEmpty {
|
||||
elements.append(errorLabel)
|
||||
}
|
||||
}
|
||||
|
||||
if let helperText, !helperText.isEmpty {
|
||||
elements.append(helperLabel)
|
||||
}
|
||||
|
||||
return elements
|
||||
}
|
||||
|
||||
set { super.accessibilityElements = newValue }
|
||||
}
|
||||
|
||||
/// Resets to default settings.
|
||||
@ -184,7 +204,7 @@ open class DatePicker: EntryFieldBase, DatePickerViewControllerDelegate, UIPopov
|
||||
controller.dismiss(animated: true) { [weak self] in
|
||||
guard let self else { return }
|
||||
self.sendActions(for: .valueChanged)
|
||||
UIAccessibility.post(notification: .layoutChanged, argument: self.fieldStackView)
|
||||
UIAccessibility.post(notification: .layoutChanged, argument: self.containerView)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ open class DropdownSelect: EntryFieldBase {
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
fieldStackView.isAccessibilityElement = true
|
||||
containerView.isAccessibilityElement = true
|
||||
inlineDisplayLabel.isAccessibilityElement = true
|
||||
|
||||
dropdownField.width(0)
|
||||
@ -278,15 +278,15 @@ open class DropdownSelect: EntryFieldBase {
|
||||
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
fieldStackView.accessibilityLabel = "Dropdown Select, \(accessibilityLabelText)"
|
||||
fieldStackView.accessibilityHint = isReadOnly || !isEnabled ? "" : "has popup, Double tap to open."
|
||||
fieldStackView.accessibilityValue = value
|
||||
containerView.accessibilityLabel = "Dropdown Select, \(accessibilityLabelText)"
|
||||
containerView.accessibilityHint = isReadOnly || !isEnabled ? "" : "has popup, Double tap to open."
|
||||
containerView.accessibilityValue = value
|
||||
}
|
||||
|
||||
open override var accessibilityElements: [Any]? {
|
||||
get {
|
||||
var elements = [Any]()
|
||||
elements.append(contentsOf: [titleLabel, fieldStackView])
|
||||
elements.append(contentsOf: [titleLabel, containerView])
|
||||
|
||||
if showError {
|
||||
elements.append(statusIcon)
|
||||
@ -310,7 +310,7 @@ open class DropdownSelect: EntryFieldBase {
|
||||
optionsPicker.isHidden = true
|
||||
dropdownField.resignFirstResponder()
|
||||
setNeedsUpdate()
|
||||
UIAccessibility.post(notification: .layoutChanged, argument: fieldStackView)
|
||||
UIAccessibility.post(notification: .layoutChanged, argument: containerView)
|
||||
}
|
||||
|
||||
open override var canBecomeFirstResponder: Bool {
|
||||
@ -337,8 +337,8 @@ extension DropdownSelect: UIPickerViewDelegate, UIPickerViewDataSource {
|
||||
|
||||
internal func launchPicker() {
|
||||
if optionsPicker.isHidden {
|
||||
UIAccessibility.post(notification: .layoutChanged, argument: optionsPicker)
|
||||
dropdownField.becomeFirstResponder()
|
||||
UIAccessibility.post(notification: .layoutChanged, argument: optionsPicker)
|
||||
} else {
|
||||
dropdownField.resignFirstResponder()
|
||||
}
|
||||
|
||||
@ -181,6 +181,9 @@ open class InputField: EntryFieldBase {
|
||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
containerView.isAccessibilityElement = true
|
||||
textField.isAccessibilityElement = false
|
||||
|
||||
textField.heightAnchor.constraint(equalToConstant: 20).isActive = true
|
||||
textField.delegate = self
|
||||
bottomContainerStackView.insertArrangedSubview(successLabel, at: 0)
|
||||
@ -230,8 +233,9 @@ open class InputField: EntryFieldBase {
|
||||
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
textField.accessibilityLabel = accessibilityLabelText
|
||||
textField.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to open."
|
||||
containerView.accessibilityLabel = "Input Field, \(accessibilityLabelText)"
|
||||
containerView.accessibilityHint = isReadOnly || !isEnabled ? "" : "Double tap to edit."
|
||||
containerView.accessibilityValue = value
|
||||
}
|
||||
|
||||
open override func updateErrorLabel() {
|
||||
@ -264,7 +268,7 @@ open class InputField: EntryFieldBase {
|
||||
open override var accessibilityElements: [Any]? {
|
||||
get {
|
||||
var elements = [Any]()
|
||||
elements.append(contentsOf: [titleLabel, textField])
|
||||
elements.append(contentsOf: [titleLabel, containerView])
|
||||
if showError {
|
||||
elements.append(statusIcon)
|
||||
if let errorText, !errorText.isEmpty {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user