diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 88e57b9d..c2fc5e62 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -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; diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 3aa5f05d..0e804b30 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -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 diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index d4ac06a0..9082aad5 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -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() diff --git a/VDS/Components/Toggle/ToggleView.swift b/VDS/Components/Toggle/ToggleView.swift index f4d257d5..b1aa030c 100644 --- a/VDS/Components/Toggle/ToggleView.swift +++ b/VDS/Components/Toggle/ToggleView.swift @@ -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) diff --git a/VDS/Components/Tooltip/TooltipDialog.swift b/VDS/Components/Tooltip/TooltipDialog.swift index a5db8627..6a50b275 100644 --- a/VDS/Components/Tooltip/TooltipDialog.swift +++ b/VDS/Components/Tooltip/TooltipDialog.swift @@ -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) diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 90973c50..6fc26df1 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,3 +1,8 @@ +1.0.47 +======= +- ONEAPP-4684 - Acessibility - Tooltip (Header) +- ONEAPP-4828 - Accessibility - Toggle (State) + 1.0.46 ======= - ONEAPP-4828 - Accessibility - Toggle