Digital ACT-191 ONEAPP-9311 story: added accessibility changes
This commit is contained in:
parent
90eb01cb24
commit
3ea4b74af2
@ -104,6 +104,11 @@ open class InputStepper: EntryFieldBase {
|
|||||||
/// Accepts any text or character to appear next to input stepper value.
|
/// Accepts any text or character to appear next to input stepper value.
|
||||||
open var trailingText: String? { didSet { setNeedsUpdate() } }
|
open var trailingText: String? { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
|
/// Value for the textField
|
||||||
|
open override var value: String? {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -111,6 +116,7 @@ open class InputStepper: EntryFieldBase {
|
|||||||
/// The only subview of this view is the stepperStackView.
|
/// The only subview of this view is the stepperStackView.
|
||||||
internal var stepperContainerView = View().with {
|
internal var stepperContainerView = View().with {
|
||||||
$0.isAccessibilityElement = true
|
$0.isAccessibilityElement = true
|
||||||
|
$0.accessibilityLabel = "Input Stepper"
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var stepperStackView = UIStackView().with {
|
internal var stepperStackView = UIStackView().with {
|
||||||
@ -145,7 +151,7 @@ open class InputStepper: EntryFieldBase {
|
|||||||
$0.lineBreakMode = .byTruncatingTail
|
$0.lineBreakMode = .byTruncatingTail
|
||||||
$0.textAlignment = .center
|
$0.textAlignment = .center
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -175,11 +181,7 @@ open class InputStepper: EntryFieldBase {
|
|||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
// accessibility
|
|
||||||
isAccessibilityElement = false
|
|
||||||
accessibilityLabel = "Input Stepper"
|
|
||||||
|
|
||||||
// Set initial states
|
// Set initial states
|
||||||
containerView.isEnabled = false
|
containerView.isEnabled = false
|
||||||
statusIcon.isHidden = true
|
statusIcon.isHidden = true
|
||||||
@ -238,6 +240,30 @@ open class InputStepper: EntryFieldBase {
|
|||||||
setNeedsLayout()
|
setNeedsLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override var accessibilityElements: [Any]? {
|
||||||
|
get {
|
||||||
|
var elements = [Any]()
|
||||||
|
|
||||||
|
if !isReadOnly || isEnabled {
|
||||||
|
elements.append(contentsOf: [titleLabel, containerView, decrementButton, textLabel, incrementButton])
|
||||||
|
} else {
|
||||||
|
elements.append(contentsOf: [titleLabel, containerView, textLabel])
|
||||||
|
}
|
||||||
|
|
||||||
|
if showError {
|
||||||
|
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.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user