Merge branch 'mbruce/bugfixes' into 'develop'

Accessibility Bugs

See merge request BPHV_MIPS/vds_ios!121
This commit is contained in:
Bruce, Matt R 2023-10-27 18:54:12 +00:00
commit 8f421d3793
6 changed files with 25 additions and 15 deletions

View File

@ -1175,7 +1175,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 46;
CURRENT_PROJECT_VERSION = 47;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
@ -1212,7 +1212,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 46;
CURRENT_PROJECT_VERSION = 47;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -61,7 +61,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
isUserInteractionEnabled = !actions.isEmpty
if actions.isEmpty {
tapGesture = nil
accessibilityTraits = .staticText
} else {
//add tap gesture
if tapGesture == nil {
@ -174,6 +174,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
lineBreakMode = .byWordWrapping
translatesAutoresizingMaskIntoConstraints = false
accessibilityCustomActions = []
isAccessibilityElement = true
accessibilityTraits = .staticText
textAlignment = .left
setup()
@ -304,7 +305,6 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
if let accessibilityElements, !accessibilityElements.isEmpty {
let staticText = UIAccessibilityElement(accessibilityContainer: self)
staticText.accessibilityLabel = text
staticText.accessibilityTraits = .staticText
staticText.accessibilityFrameInContainerSpace = bounds
isAccessibilityElement = false

View File

@ -60,7 +60,6 @@ open class Toggle: Control, Changeable, FormFieldable {
//--------------------------------------------------
private let toggleContainerSize = CGSize(width: 52, height: 44)
private let spacingBetween = VDSLayout.Spacing.space3X.value
private let labelMaxWidth = 40.0
/// TextStyle used to render the label.
private var textStyle: TextStyle {
@ -184,12 +183,14 @@ open class Toggle: Control, Changeable, FormFieldable {
super.setup()
isAccessibilityElement = true
accessibilityTraits = .button
if #available(iOS 17.0, *) {
accessibilityTraits = .toggleButton
} else {
accessibilityTraits = .button
}
addSubview(label)
addSubview(toggleView)
label.widthLessThanEqualTo(labelMaxWidth)
// Set up initial constraints for label and switch
toggleView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
@ -247,14 +248,13 @@ open class Toggle: Control, Changeable, FormFieldable {
/// Used to update any Accessibility properties.
open override func updateAccessibility() {
super.updateAccessibility()
if showText {
setAccessibilityLabel(for: [label])
accessibilityValue = isSelected ? onText : offText
} else {
accessibilityLabel = "Toggle"
accessibilityValue = isSelected ? "On" : "Off"
}
}
/// This will change the state of the Selector and execute the actionBlock if provided.
open func toggle() {
isOn.toggle()

View File

@ -117,7 +117,11 @@ open class ToggleView: Control, Changeable, FormFieldable {
super.setup()
isAccessibilityElement = true
accessibilityTraits = .button
if #available(iOS 17.0, *) {
accessibilityTraits = .toggleButton
} else {
accessibilityTraits = .button
}
addSubview(toggleView)
toggleView.addSubview(knobView)

View File

@ -58,7 +58,6 @@ open class TooltipDialog: View, UIScrollViewDelegate {
open var titleLabel = Label().with { label in
label.isAccessibilityElement = true
label.accessibilityTraits = .header
label.textStyle = .boldTitleMedium
}
@ -99,6 +98,8 @@ open class TooltipDialog: View, UIScrollViewDelegate {
open override func setup() {
super.setup()
titleLabel.accessibilityTraits = .header
layer.cornerRadius = 8
contentStackView.addArrangedSubview(titleLabel)
contentStackView.addArrangedSubview(contentLabel)

View File

@ -1,3 +1,8 @@
1.0.47
=======
- ONEAPP-4684 - Acessibility - Tooltip (Header)
- ONEAPP-4828 - Accessibility - Toggle (State)
1.0.46
=======
- ONEAPP-4828 - Accessibility - Toggle