From 196bc522889535b4b2e125f7edadc861a1924a2c Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 27 Oct 2023 13:14:36 -0500 Subject: [PATCH 1/4] ONEAPP-4684 - Acessibility - Tooltip (Header) Signed-off-by: Matt Bruce --- VDS/Components/Label/Label.swift | 4 ++-- VDS/Components/Tooltip/TooltipDialog.swift | 3 ++- VDS/SupportingFiles/ReleaseNotes.txt | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) 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/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..d042255b 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,3 +1,7 @@ +1.0.47 +======= +- ONEAPP-4684 - Acessibility - Tooltip (Header) + 1.0.46 ======= - ONEAPP-4828 - Accessibility - Toggle From 2f3759ae903edabebd9c6485b530b249d0d2fb37 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 27 Oct 2023 13:15:08 -0500 Subject: [PATCH 2/4] ONEAPP-4828 - Accessibility - Toggle (State) Signed-off-by: Matt Bruce --- VDS/Components/Toggle/Toggle.swift | 12 ++++-------- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index d4ac06a0..47db0732 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 { @@ -187,9 +186,7 @@ open class Toggle: Control, Changeable, FormFieldable { 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 +244,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/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index d042255b..6fc26df1 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,6 +1,7 @@ 1.0.47 ======= - ONEAPP-4684 - Acessibility - Tooltip (Header) +- ONEAPP-4828 - Accessibility - Toggle (State) 1.0.46 ======= From a349359fdf5efb702b59bcfc495ce0e42b7b3f76 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 27 Oct 2023 13:40:20 -0500 Subject: [PATCH 3/4] updated for toggleBottom IF iOS 17 Signed-off-by: Matt Bruce --- VDS/Components/Toggle/Toggle.swift | 6 +++++- VDS/Components/Toggle/ToggleView.swift | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index 47db0732..9082aad5 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -183,7 +183,11 @@ 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) 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) From 503957af1de584f9fb350e639fbe53af5fe52b55 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 27 Oct 2023 13:41:23 -0500 Subject: [PATCH 4/4] updated version Signed-off-by: Matt Bruce --- VDS.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;