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; BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 46; CURRENT_PROJECT_VERSION = 47;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
@ -1212,7 +1212,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES; BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 46; CURRENT_PROJECT_VERSION = 47;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;

View File

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

View File

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

View File

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

View File

@ -58,7 +58,6 @@ open class TooltipDialog: View, UIScrollViewDelegate {
open var titleLabel = Label().with { label in open var titleLabel = Label().with { label in
label.isAccessibilityElement = true label.isAccessibilityElement = true
label.accessibilityTraits = .header
label.textStyle = .boldTitleMedium label.textStyle = .boldTitleMedium
} }
@ -99,6 +98,8 @@ open class TooltipDialog: View, UIScrollViewDelegate {
open override func setup() { open override func setup() {
super.setup() super.setup()
titleLabel.accessibilityTraits = .header
layer.cornerRadius = 8 layer.cornerRadius = 8
contentStackView.addArrangedSubview(titleLabel) contentStackView.addArrangedSubview(titleLabel)
contentStackView.addArrangedSubview(contentLabel) 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 1.0.46
======= =======
- ONEAPP-4828 - Accessibility - Toggle - ONEAPP-4828 - Accessibility - Toggle