From c22592cdb50190d3f1297502cae13fb282fd9239 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 14:49:23 -0500 Subject: [PATCH 01/23] refactor to reset onClick/onClick to nil removed old willSet Signed-off-by: Matt Bruce --- VDS/BaseClasses/Control.swift | 10 +++------- VDS/BaseClasses/Selector/SelectorBase.swift | 12 +++++------- VDS/BaseClasses/Selector/SelectorGroupBase.swift | 9 ++------- VDS/BaseClasses/Selector/SelectorItemBase.swift | 9 ++------- VDS/Components/Buttons/ButtonBase.swift | 10 +++------- VDS/Components/Icon/ButtonIcon/ButtonIcon.swift | 3 +-- VDS/Components/RadioBox/RadioBoxItem.swift | 9 ++------- VDS/Components/TextFields/EntryFieldBase.swift | 9 ++------- VDS/Components/TileContainer/TileContainer.swift | 8 +++++++- VDS/Components/Tilelet/Tilelet.swift | 6 ------ VDS/Components/Toggle/Toggle.swift | 9 ++------- VDS/Components/Toggle/ToggleView.swift | 1 + VDS/Protocols/Changeable.swift | 2 ++ VDS/Protocols/Clickable.swift | 2 +- 14 files changed, 33 insertions(+), 66 deletions(-) diff --git a/VDS/BaseClasses/Control.swift b/VDS/BaseClasses/Control.swift index cc2246aa..274d7d9b 100644 --- a/VDS/BaseClasses/Control.swift +++ b/VDS/BaseClasses/Control.swift @@ -35,13 +35,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { //-------------------------------------------------- open var subscribers = Set() - open var onClickSubscriber: AnyCancellable? { - willSet { - if let onClickSubscriber { - onClickSubscriber.cancel() - } - } - } + open var onClickSubscriber: AnyCancellable? //-------------------------------------------------- // MARK: - Private Properties @@ -118,6 +112,8 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { backgroundColor = .clear surface = .light isEnabled = true + onClick = nil + userInfo.removeAll() } //-------------------------------------------------- diff --git a/VDS/BaseClasses/Selector/SelectorBase.swift b/VDS/BaseClasses/Selector/SelectorBase.swift index 9552b50e..e74ca342 100644 --- a/VDS/BaseClasses/Selector/SelectorBase.swift +++ b/VDS/BaseClasses/Selector/SelectorBase.swift @@ -47,13 +47,7 @@ open class SelectorBase: Control, SelectorControlable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - open var onChangeSubscriber: AnyCancellable? { - willSet { - if let onChangeSubscriber { - onChangeSubscriber.cancel() - } - } - } + open var onChangeSubscriber: AnyCancellable? open var size = CGSize(width: 20, height: 20) { didSet { setNeedsUpdate() } } @@ -135,4 +129,8 @@ open class SelectorBase: Control, SelectorControlable { /// This will change the state of the Selector and execute the actionBlock if provided. open func toggle() { } + open override func reset() { + super.reset() + onChange = nil + } } diff --git a/VDS/BaseClasses/Selector/SelectorGroupBase.swift b/VDS/BaseClasses/Selector/SelectorGroupBase.swift index 64b3cdee..997a71b2 100644 --- a/VDS/BaseClasses/Selector/SelectorGroupBase.swift +++ b/VDS/BaseClasses/Selector/SelectorGroupBase.swift @@ -75,13 +75,7 @@ open class SelectorGroupBase: Control, SelectorGroup, } } - open var onChangeSubscriber: AnyCancellable? { - willSet { - if let onChangeSubscriber { - onChangeSubscriber.cancel() - } - } - } + open var onChangeSubscriber: AnyCancellable? /// Whether the Control is enabled or not. override open var isEnabled: Bool { @@ -130,6 +124,7 @@ open class SelectorGroupBase: Control, SelectorGroup, /// Resets to default settings. open override func reset() { super.reset() + onChange = nil items.forEach{ $0.reset() } } } diff --git a/VDS/BaseClasses/Selector/SelectorItemBase.swift b/VDS/BaseClasses/Selector/SelectorItemBase.swift index 1900c2c5..9eee8f29 100644 --- a/VDS/BaseClasses/Selector/SelectorItemBase.swift +++ b/VDS/BaseClasses/Selector/SelectorItemBase.swift @@ -61,13 +61,7 @@ open class SelectorItemBase: Control, Errorable, //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - open var onChangeSubscriber: AnyCancellable? { - willSet { - if let onChangeSubscriber { - onChangeSubscriber.cancel() - } - } - } + open var onChangeSubscriber: AnyCancellable? /// Label used to render labelText. open var label = Label().with { @@ -223,6 +217,7 @@ open class SelectorItemBase: Control, Errorable, value = nil isSelected = false + onChange = nil shouldUpdateView = true setNeedsUpdate() } diff --git a/VDS/Components/Buttons/ButtonBase.swift b/VDS/Components/Buttons/ButtonBase.swift index b0694848..80010ee5 100644 --- a/VDS/Components/Buttons/ButtonBase.swift +++ b/VDS/Components/Buttons/ButtonBase.swift @@ -38,13 +38,7 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable { /// Set of Subscribers for any Publishers for this Control. open var subscribers = Set() - open var onClickSubscriber: AnyCancellable? { - willSet { - if let onClickSubscriber { - onClickSubscriber.cancel() - } - } - } + open var onClickSubscriber: AnyCancellable? //-------------------------------------------------- // MARK: - Private Properties @@ -140,6 +134,8 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable { isEnabled = true text = nil accessibilityCustomActions = [] + onClick = nil + userInfo.removeAll() shouldUpdateView = true setNeedsUpdate() } diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index 864397d3..cf3afdc3 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -172,8 +172,6 @@ open class ButtonIcon: Control, Changeable, FormFieldable { /// Used to move the icon inside the button in both x and y axis. open var iconOffset: CGPoint = .init(x: 0, y: 0) { didSet { setNeedsUpdate() } } - open var onChangeSubscriber: AnyCancellable? - open var inputId: String? { didSet { setNeedsUpdate() } } open var value: AnyHashable? { didSet { setNeedsUpdate() } } @@ -436,6 +434,7 @@ open class ButtonIcon: Control, Changeable, FormFieldable { showBadgeIndicator = false selectable = false badgeIndicatorModel = nil + onChange = nil shouldUpdateView = true setNeedsUpdate() } diff --git a/VDS/Components/RadioBox/RadioBoxItem.swift b/VDS/Components/RadioBox/RadioBoxItem.swift index de6223e1..17d509c2 100644 --- a/VDS/Components/RadioBox/RadioBoxItem.swift +++ b/VDS/Components/RadioBox/RadioBoxItem.swift @@ -52,13 +52,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - open var onChangeSubscriber: AnyCancellable? { - willSet { - if let onChangeSubscriber { - onChangeSubscriber.cancel() - } - } - } + open var onChangeSubscriber: AnyCancellable? /// Label used to render the text. open var textLabel = Label().with { @@ -218,6 +212,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { value = nil isSelected = false + onChange = nil shouldUpdateView = true setNeedsUpdate() diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index 7ce12d75..9f7cf49d 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -119,13 +119,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - open var onChangeSubscriber: AnyCancellable? { - willSet { - if let onChangeSubscriber { - onChangeSubscriber.cancel() - } - } - } + open var onChangeSubscriber: AnyCancellable? open var titleLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) @@ -304,6 +298,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { defaultValue = nil required = false readOnly = false + onChange = nil } /// Used to make changes to the View based off a change events or from local properties. diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 61b91eaf..480cbc09 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -8,6 +8,7 @@ import Foundation import VDSTokens import UIKit +import Combine @objc(VDSTileContainer) open class TileContainer: TileContainerBase { @@ -43,7 +44,6 @@ open class TileContainer: TileContainerBase { } open class TileContainerBase: Control where PaddingType.ValueType == CGFloat { - //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -111,6 +111,12 @@ open class TileContainerBase: Control where Padding //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- + public override var onClickSubscriber: AnyCancellable? { + didSet { + isAccessibilityElement = onClickSubscriber != nil + } + } + /// This takes an image source url and applies it as a background image. open var backgroundImage: UIImage? { didSet { setNeedsUpdate() } } diff --git a/VDS/Components/Tilelet/Tilelet.swift b/VDS/Components/Tilelet/Tilelet.swift index ba03ed5f..77477576 100644 --- a/VDS/Components/Tilelet/Tilelet.swift +++ b/VDS/Components/Tilelet/Tilelet.swift @@ -105,12 +105,6 @@ open class Tilelet: TileContainerBase { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - public override var onClickSubscriber: AnyCancellable? { - didSet { - isAccessibilityElement = onClickSubscriber != nil - } - } - /// Title lockup positioned in the contentView. open var titleLockup = TitleLockup().with { $0.standardStyleConfiguration = .init(styleConfigurations: [ diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index 9e77ed12..b73630d6 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -88,13 +88,7 @@ open class Toggle: Control, Changeable, FormFieldable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - open var onChangeSubscriber: AnyCancellable? { - willSet { - if let onChangeSubscriber { - onChangeSubscriber.cancel() - } - } - } + open var onChangeSubscriber: AnyCancellable? /// Actual toggle used in this component. open var toggleView = ToggleView().with { @@ -231,6 +225,7 @@ open class Toggle: Control, Changeable, FormFieldable { textPosition = .left inputId = nil value = nil + onChange = nil shouldUpdateView = true setNeedsUpdate() } diff --git a/VDS/Components/Toggle/ToggleView.swift b/VDS/Components/Toggle/ToggleView.swift index ef88d914..16b8307e 100644 --- a/VDS/Components/Toggle/ToggleView.swift +++ b/VDS/Components/Toggle/ToggleView.swift @@ -166,6 +166,7 @@ open class ToggleView: Control, Changeable, FormFieldable { value = nil toggleView.backgroundColor = toggleColorConfiguration.getColor(self) knobView.backgroundColor = knobColorConfiguration.getColor(self) + onChange = nil shouldUpdateView = true setNeedsUpdate() } diff --git a/VDS/Protocols/Changeable.swift b/VDS/Protocols/Changeable.swift index 6ef3eb8e..c44fa841 100644 --- a/VDS/Protocols/Changeable.swift +++ b/VDS/Protocols/Changeable.swift @@ -26,6 +26,8 @@ extension Changeable { .sink { c in newValue(c) } + } else { + onChangeSubscriber = nil } } } diff --git a/VDS/Protocols/Clickable.swift b/VDS/Protocols/Clickable.swift index 29b66aaf..eddcfa3c 100644 --- a/VDS/Protocols/Clickable.swift +++ b/VDS/Protocols/Clickable.swift @@ -20,6 +20,7 @@ extension Clickable { public var onClick: ((Self) -> ())? { get { return nil } set { + onClickSubscriber?.cancel() if let newValue { onClickSubscriber = publisher(for: .touchUpInside) .sink { [weak self] c in @@ -27,7 +28,6 @@ extension Clickable { newValue(c) } } else { - onClickSubscriber?.cancel() onClickSubscriber = nil } } From e4bd72c64a22f9bb1f0833799c20d1fedec155a8 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 14:54:44 -0500 Subject: [PATCH 02/23] added conformance back Signed-off-by: Matt Bruce --- VDS/Components/Icon/ButtonIcon/ButtonIcon.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index cf3afdc3..b1473262 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -109,7 +109,8 @@ open class ButtonIcon: Control, Changeable, FormFieldable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - + public var onChangeSubscriber: AnyCancellable? + ///Badge Indicator object used to render for the ButtonIcon. open var badgeIndicator = BadgeIndicator().with { $0.translatesAutoresizingMaskIntoConstraints = false From 788fcb73aca00d51fde2b97631d3ded81c5d5121 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 15:12:21 -0500 Subject: [PATCH 03/23] updated tile container click Signed-off-by: Matt Bruce --- VDS/Components/TileContainer/TileContainer.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 480cbc09..fab4ccfc 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -113,7 +113,14 @@ open class TileContainerBase: Control where Padding //-------------------------------------------------- public override var onClickSubscriber: AnyCancellable? { didSet { - isAccessibilityElement = onClickSubscriber != nil + if onClickSubscriber != nil { + isAccessibilityElement = true + accessibilityTraits = .button + accessibilityHint = "Double tap to open." + } else { + isAccessibilityElement = false + accessibilityTraits.remove(.button) + } } } From 90ec2fa8f2f4c9cee7c747d2045b7fb97f956648 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 15:28:12 -0500 Subject: [PATCH 04/23] updated accessibility elements Signed-off-by: Matt Bruce --- VDS/Components/Tilelet/Tilelet.swift | 35 +++++++++++++------- VDS/Components/TitleLockup/TitleLockup.swift | 16 ++++++++- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/VDS/Components/Tilelet/Tilelet.swift b/VDS/Components/Tilelet/Tilelet.swift index 77477576..e79f36f0 100644 --- a/VDS/Components/Tilelet/Tilelet.swift +++ b/VDS/Components/Tilelet/Tilelet.swift @@ -22,7 +22,7 @@ open class Tilelet: TileContainerBase { public enum Padding: String, DefaultValuing, CaseIterable { case small case large - + public static var defaultValue: Self { .large } public var value: CGFloat { @@ -63,7 +63,7 @@ open class Tilelet: TileContainerBase { public required init?(coder: NSCoder) { super.init(coder: coder) } - + //-------------------------------------------------- // MARK: - Enums //-------------------------------------------------- @@ -207,7 +207,7 @@ open class Tilelet: TileContainerBase { open var directionalIcon = Icon().with { $0.name = .rightArrow } - + private var _textWidth: TextWidth? /// If provided, width of Button components will be rendered based on this value. If omitted, default button widths are rendered. @@ -270,7 +270,7 @@ open class Tilelet: TileContainerBase { _descriptiveIconModel = nil setNeedsUpdate() } - } + } //-------------------------------------------------- // MARK: - Constraints @@ -288,7 +288,7 @@ open class Tilelet: TileContainerBase { internal var titleLockupEyebrowLabelHeightGreaterThanConstraint: NSLayoutConstraint? internal var titleLockupTitleLabelHeightGreaterThanConstraint: NSLayoutConstraint? internal var titleLockupSubTitleLabelHeightGreaterThanConstraint: NSLayoutConstraint? - + //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- @@ -299,9 +299,6 @@ open class Tilelet: TileContainerBase { color = .black addContentView(stackView) - accessibilityTraits = .link - accessibilityElements = [badge, titleLockup, descriptiveIcon, directionalIcon] - //badge badgeContainerView.addSubview(badge) badge @@ -322,7 +319,7 @@ open class Tilelet: TileContainerBase { titleLockupBottomGreaterThanConstraint = titleLockupContainerView.bottomAnchor.constraint(greaterThanOrEqualTo: titleLockup.bottomAnchor) titleLockupTopGreaterThanConstraint = titleLockup.topAnchor.constraint(greaterThanOrEqualTo: titleLockupContainerView.topAnchor) titleLockupCenterYConstraint = titleLockup.centerYAnchor.constraint(equalTo: titleLockupContainerView.centerYAnchor) - + iconContainerView.addSubview(descriptiveIcon) iconContainerView.addSubview(directionalIcon) @@ -351,12 +348,12 @@ open class Tilelet: TileContainerBase { badge.label.setContentCompressionResistancePriority(UILayoutPriority(labelPriority-1), for: .vertical) titleLockup.subTitleLabel.setContentCompressionResistancePriority(UILayoutPriority(labelPriority-2), for: .vertical) titleLockup.eyebrowLabel.setContentCompressionResistancePriority(UILayoutPriority(labelPriority-3), for: .vertical) - + titleLockup.titleLabel.setContentHuggingPriority(UILayoutPriority(labelPriority), for: .vertical) badge.label.setContentHuggingPriority(UILayoutPriority(labelPriority-1), for: .vertical) titleLockup.subTitleLabel.setContentHuggingPriority(UILayoutPriority(labelPriority-2), for: .vertical) titleLockup.eyebrowLabel.setContentHuggingPriority(UILayoutPriority(labelPriority-3), for: .vertical) - + /** Added these constraints for: At fixed width & height if all the labels(Badge, Eyebrow, Title, Subtitle) are having more number of lines then we should display atleast one line of content per label instead of pushing labels out of bounds. @@ -412,7 +409,21 @@ open class Tilelet: TileContainerBase { /// Used to update any Accessibility properties. open override func updateAccessibility() { super.updateAccessibility() - + var elements = [Any]() + if badgeModel != nil { + elements.append(badge) + } + if titleModel != nil || subTitleModel != nil || eyebrowModel != nil { + elements.append(titleLockup) + } + if descriptiveIconModel != nil { + elements.append(descriptiveIcon) + } + if directionalIconModel != nil { + elements.append(directionalIcon) + } + accessibilityElements = elements.count > 0 ? elements : nil + setAccessibilityLabel(for: [badge.label, titleLockup.eyebrowLabel, titleLockup.titleLabel, titleLockup.subTitleLabel]) } diff --git a/VDS/Components/TitleLockup/TitleLockup.swift b/VDS/Components/TitleLockup/TitleLockup.swift index a8fab6fa..c0c3b0b5 100644 --- a/VDS/Components/TitleLockup/TitleLockup.swift +++ b/VDS/Components/TitleLockup/TitleLockup.swift @@ -272,7 +272,21 @@ open class TitleLockup: View { titleLabel.textColorConfiguration = textColorPrimaryConfiguration - accessibilityElements = [eyebrowLabel, titleLabel, subTitleLabel] + } + + open override func updateAccessibility() { + super.updateAccessibility() + var elements = [Any]() + if eyebrowModel != nil { + elements.append(eyebrowLabel) + } + if titleModel != nil { + elements.append(titleLabel) + } + if subTitleModel != nil { + elements.append(subTitleLabel) + } + accessibilityElements = elements.count > 0 ? elements : nil } /// Resets to default settings. From 324601d490e10366c3662f4de06db1fe68542955 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 15:28:19 -0500 Subject: [PATCH 05/23] update tilecontainer Signed-off-by: Matt Bruce --- VDS/Components/TileContainer/TileContainer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index fab4ccfc..6d3f5dd6 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -115,11 +115,11 @@ open class TileContainerBase: Control where Padding didSet { if onClickSubscriber != nil { isAccessibilityElement = true - accessibilityTraits = .button + accessibilityTraits = .link accessibilityHint = "Double tap to open." } else { isAccessibilityElement = false - accessibilityTraits.remove(.button) + accessibilityTraits.remove(.link) } } } From 6a8285d8b1bb90bb7ff83654cfb7bff46c552c6a Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 15:31:08 -0500 Subject: [PATCH 06/23] updated accessibility Signed-off-by: Matt Bruce --- VDS/Components/Icon/ButtonIcon/ButtonIcon.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index b1473262..28614e59 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -364,7 +364,6 @@ open class ButtonIcon: Control, Changeable, FormFieldable { open override func setup() { super.setup() isAccessibilityElement = false - accessibilityElements = [icon, badgeIndicator] //create a layoutGuide for the icon to key off of let iconLayoutGuide = UILayoutGuide() @@ -459,6 +458,18 @@ open class ButtonIcon: Control, Changeable, FormFieldable { setNeedsLayout() } + open override func updateAccessibility() { + super.updateAccessibility() + var elements = [Any]() + if iconName != nil { + elements.append(icon) + } + if badgeIndicatorModel != nil { + elements.append(badgeIndicator) + } + accessibilityElements = elements.count > 0 ? elements : nil + } + open override func layoutSubviews() { super.layoutSubviews() From 7c8690bcb486c1a42a5b6ec4dfa6390f4ebe8cab Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 15:32:56 -0500 Subject: [PATCH 07/23] added other value Signed-off-by: Matt Bruce --- VDS/Components/Icon/ButtonIcon/ButtonIcon.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index 28614e59..658cb05e 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -464,7 +464,7 @@ open class ButtonIcon: Control, Changeable, FormFieldable { if iconName != nil { elements.append(icon) } - if badgeIndicatorModel != nil { + if badgeIndicatorModel != nil && showBadgeIndicator { elements.append(badgeIndicator) } accessibilityElements = elements.count > 0 ? elements : nil From 86c675a07f191ebb499f5cb623401654e1e6d3d9 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 16:41:38 -0500 Subject: [PATCH 08/23] fixed color attribute Signed-off-by: Matt Bruce --- VDS/Components/Label/Attributes/ColorLabelAttribute.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Label/Attributes/ColorLabelAttribute.swift b/VDS/Components/Label/Attributes/ColorLabelAttribute.swift index 50229ab0..0e6dd653 100644 --- a/VDS/Components/Label/Attributes/ColorLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/ColorLabelAttribute.swift @@ -31,12 +31,14 @@ public struct ColorLabelAttribute: LabelAttributeModel { } public func setAttribute(on attributedString: NSMutableAttributedString) { - guard isValidRange(on: attributedString) else { return } - var colorRange = range if length == 0 && location == 0 { colorRange = .init(location: location, length: attributedString.length) + if !attributedString.isValid(range: colorRange) { return } + } else { + guard isValidRange(on: attributedString) else { return } } + let attributeKey = isForegroundColor ? NSAttributedString.Key.foregroundColor : NSAttributedString.Key.backgroundColor attributedString.removeAttribute(attributeKey, range: colorRange) attributedString.addAttribute(attributeKey, value: color, range: colorRange) From bb655eefa290342fc30fd3deaad589e84f134c6d Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 16:42:24 -0500 Subject: [PATCH 09/23] ensure color range Signed-off-by: Matt Bruce --- VDS/Components/Label/Attributes/ColorLabelAttribute.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Label/Attributes/ColorLabelAttribute.swift b/VDS/Components/Label/Attributes/ColorLabelAttribute.swift index 0e6dd653..fd1b9a21 100644 --- a/VDS/Components/Label/Attributes/ColorLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/ColorLabelAttribute.swift @@ -34,10 +34,9 @@ public struct ColorLabelAttribute: LabelAttributeModel { var colorRange = range if length == 0 && location == 0 { colorRange = .init(location: location, length: attributedString.length) - if !attributedString.isValid(range: colorRange) { return } - } else { - guard isValidRange(on: attributedString) else { return } } + + if !attributedString.isValid(range: colorRange) { return } let attributeKey = isForegroundColor ? NSAttributedString.Key.foregroundColor : NSAttributedString.Key.backgroundColor attributedString.removeAttribute(attributeKey, range: colorRange) From 5570507f27b0371f724fb0db34598694dbf6cde4 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 16:56:47 -0500 Subject: [PATCH 10/23] remove from superView before adding as a subview Signed-off-by: Matt Bruce --- VDS/Components/TileContainer/TileContainer.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 6d3f5dd6..34f4dbd4 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -350,6 +350,7 @@ open class TileContainerBase: Control where Padding /// This will place a view within the contentView of this component. public func addContentView(_ view: UIView, shouldPin: Bool = true) { + view.removeFromSuperview() containerView.addSubview(view) if shouldPin { view.pinToSuperView() From 18c68b39495910fec915ecf7a4b3cf538cc55800 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 25 Apr 2024 14:56:58 -0500 Subject: [PATCH 11/23] removed plural Signed-off-by: Matt Bruce --- VDS/Components/TileContainer/TileContainer.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 61b91eaf..cef80bcc 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -171,7 +171,7 @@ open class TileContainerBase: Control where Padding open var showBorder: Bool = false { didSet { setNeedsUpdate() } } /// Determines if there is a drop shadow or not. - open var showDropShadows: Bool = false { didSet { setNeedsUpdate() } } + open var showDropShadow: Bool = false { didSet { setNeedsUpdate() } } //-------------------------------------------------- // MARK: - Constraints @@ -274,7 +274,7 @@ open class TileContainerBase: Control where Padding width = nil height = nil showBorder = false - showDropShadows = false + showDropShadow = false shouldUpdateView = true setNeedsUpdate() } @@ -316,7 +316,7 @@ open class TileContainerBase: Control where Padding widthConstraint?.isActive = false heightConstraint?.isActive = false } - if showDropShadows, surface == .light { + if showDropShadow, surface == .light { addDropShadow(dropShadowConfiguration) } else { removeDropShadows() From b83dc8c8a2f08268ca5681ffe69bf250080c1447 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 25 Apr 2024 16:39:30 -0500 Subject: [PATCH 12/23] remvoed layoutifneeded Signed-off-by: Matt Bruce --- VDS/BaseClasses/Selector/SelectorBase.swift | 7 ------- VDS/Components/BadgeIndicator/BadgeIndicator.swift | 1 - VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift | 2 +- VDS/Components/Label/Label.swift | 1 - VDS/Components/RadioBox/RadioBoxItem.swift | 1 - VDS/Components/Tabs/Tab.swift | 1 - VDS/Components/Tilelet/Tilelet.swift | 2 +- VDS/Components/Toggle/ToggleView.swift | 1 - 8 files changed, 2 insertions(+), 14 deletions(-) diff --git a/VDS/BaseClasses/Selector/SelectorBase.swift b/VDS/BaseClasses/Selector/SelectorBase.swift index e74ca342..38d087cc 100644 --- a/VDS/BaseClasses/Selector/SelectorBase.swift +++ b/VDS/BaseClasses/Selector/SelectorBase.swift @@ -114,13 +114,6 @@ open class SelectorBase: Control, SelectorControlable { accessibilityTraits = .button } - /// Used to make changes to the View based off a change events or from local properties. - open override func updateView() { - super.updateView() - setNeedsLayout() - layoutIfNeeded() - } - /// Used to update any Accessibility properties.ß open override func updateAccessibility() { super.updateAccessibility() diff --git a/VDS/Components/BadgeIndicator/BadgeIndicator.swift b/VDS/Components/BadgeIndicator/BadgeIndicator.swift index 89d886c6..a327270d 100644 --- a/VDS/Components/BadgeIndicator/BadgeIndicator.swift +++ b/VDS/Components/BadgeIndicator/BadgeIndicator.swift @@ -344,7 +344,6 @@ open class BadgeIndicator: View { label.isEnabled = isEnabled label.sizeToFit() setNeedsLayout() - layoutIfNeeded() } open override func updateAccessibility() { diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index 08a823fa..424ebcf3 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -84,7 +84,7 @@ final class BreadcrumbCellItem: UICollectionViewCell { separator.textColor = textColorConfiguration.getColor(surface) separator.isHidden = hideSlash self.breadCrumbItem = breadCrumbItem - layoutIfNeeded() + setNeedsLayout() } } diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index df67d431..febb12ca 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -230,7 +230,6 @@ open class Label: UILabel, ViewProtocol, UserInfoable { setNeedsDisplay() setNeedsLayout() - layoutIfNeeded() } open func updateAccessibility() { diff --git a/VDS/Components/RadioBox/RadioBoxItem.swift b/VDS/Components/RadioBox/RadioBoxItem.swift index 17d509c2..c4105f42 100644 --- a/VDS/Components/RadioBox/RadioBoxItem.swift +++ b/VDS/Components/RadioBox/RadioBoxItem.swift @@ -231,7 +231,6 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { updateLabels() setNeedsLayout() - layoutIfNeeded() } /// Used to update any Accessibility properties. diff --git a/VDS/Components/Tabs/Tab.swift b/VDS/Components/Tabs/Tab.swift index af095d85..e96e20d6 100644 --- a/VDS/Components/Tabs/Tab.swift +++ b/VDS/Components/Tabs/Tab.swift @@ -172,7 +172,6 @@ extension Tabs { label.textAlignment = textAlignment.value label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() setNeedsLayout() - layoutIfNeeded() } /// Used to update any Accessibility properties. diff --git a/VDS/Components/Tilelet/Tilelet.swift b/VDS/Components/Tilelet/Tilelet.swift index e79f36f0..fb0e5cf8 100644 --- a/VDS/Components/Tilelet/Tilelet.swift +++ b/VDS/Components/Tilelet/Tilelet.swift @@ -403,7 +403,7 @@ open class Tilelet: TileContainerBase { if width != nil && (aspectRatio != .none || height != nil) { updateTextPositionAlignment() } - layoutIfNeeded() + setNeedsLayout() } /// Used to update any Accessibility properties. diff --git a/VDS/Components/Toggle/ToggleView.swift b/VDS/Components/Toggle/ToggleView.swift index 16b8307e..58001857 100644 --- a/VDS/Components/Toggle/ToggleView.swift +++ b/VDS/Components/Toggle/ToggleView.swift @@ -228,7 +228,6 @@ open class ToggleView: Control, Changeable, FormFieldable { knobTrailingConstraint?.isActive = true knobLeadingConstraint?.isActive = true setNeedsLayout() - layoutIfNeeded() } private func updateToggle() { From 9cfbe14969d8ddb69c4b51c6942b9f76e69ed5c9 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 25 Apr 2024 17:02:14 -0500 Subject: [PATCH 13/23] rearranged of when dropShadow is added Signed-off-by: Matt Bruce --- VDS/Components/TileContainer/TileContainer.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index ab053ce7..bdf19831 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -329,12 +329,14 @@ open class TileContainerBase: Control where Padding widthConstraint?.isActive = false heightConstraint?.isActive = false } + + applyBackgroundEffects() + if showDropShadow, surface == .light { addDropShadow(dropShadowConfiguration) } else { removeDropShadows() } - applyBackgroundEffects() } /// Used to update frames for the added CAlayers to our view From f432f6be0e96a2b6b4ea861967c641b64b6a2ffe Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 26 Apr 2024 10:26:59 -0500 Subject: [PATCH 14/23] CXTDT-549888 - Voiceover issues on next/previous Signed-off-by: Matt Bruce --- VDS/Components/Pagination/Pagination.swift | 2 +- VDS/Components/Pagination/PaginationButton.swift | 5 +++++ VDS/SupportingFiles/ReleaseNotes.txt | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/VDS/Components/Pagination/Pagination.swift b/VDS/Components/Pagination/Pagination.swift index 11a5840d..f5a4e2c7 100644 --- a/VDS/Components/Pagination/Pagination.swift +++ b/VDS/Components/Pagination/Pagination.swift @@ -174,7 +174,7 @@ open class Pagination: View { let isNextAction = sender == nextButton _selectedPageIndex = if isNextAction { _selectedPageIndex + 1 } else { _selectedPageIndex - 1 } updateSelection() - DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) { [weak self] in + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in guard let self else { return } UIAccessibility.post(notification: .announcement, argument: "Page \(self.selectedPage) of \(self.total) selected") } diff --git a/VDS/Components/Pagination/PaginationButton.swift b/VDS/Components/Pagination/PaginationButton.swift index 9e0eeb47..10745931 100644 --- a/VDS/Components/Pagination/PaginationButton.swift +++ b/VDS/Components/Pagination/PaginationButton.swift @@ -78,6 +78,11 @@ open class PaginationButton: ButtonBase { tintColor = color super.updateView() } + + open override func accessibilityActivate() -> Bool { + sendActions(for: .touchUpInside) + return true + } } extension PaginationButton { diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index d9087a9b..ac3e738f 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -3,6 +3,7 @@ - CXTDT-544442 - Button Icon - Selected state needs to allow custom color - CXTDT-546821 - TextArea - Accessibility - input field is not receiving swipe focus - CXTDT-547200 - Carousel scrollbar – Accessibility - The scrollbar is receiving right/ left swipe focus +- CXTDT-549888 - Pagination - Accessibility - Next/Previous 1.0.59 ---------------- From 4935db72d68b224d9bac9041ee236e32eeb32403 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 26 Apr 2024 10:44:17 -0500 Subject: [PATCH 15/23] CXTDT-542333 - RadioBox Padding Signed-off-by: Matt Bruce --- VDS/Components/RadioBox/RadioBoxItem.swift | 4 ++-- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VDS/Components/RadioBox/RadioBoxItem.swift b/VDS/Components/RadioBox/RadioBoxItem.swift index c4105f42..d81b68ea 100644 --- a/VDS/Components/RadioBox/RadioBoxItem.swift +++ b/VDS/Components/RadioBox/RadioBoxItem.swift @@ -38,7 +38,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { $0.alignment = .top $0.distribution = .fill $0.axis = .horizontal - $0.spacing = 12 + $0.spacing = VDSLayout.space3X } private var selectorLeftLabelStackView = UIStackView().with { @@ -183,7 +183,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { .pinTrailing(0, .defaultHigh) .pinBottom(0, .defaultHigh) - selectorStackView.pinToSuperView(.uniform(16)) + selectorStackView.pinToSuperView(.uniform(VDSLayout.space3X)) } /// Resets to default settings. diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index ac3e738f..7989a4fe 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -4,6 +4,7 @@ - CXTDT-546821 - TextArea - Accessibility - input field is not receiving swipe focus - CXTDT-547200 - Carousel scrollbar – Accessibility - The scrollbar is receiving right/ left swipe focus - CXTDT-549888 - Pagination - Accessibility - Next/Previous +- CXTDT-542333 - RadioBox Padding 1.0.59 ---------------- From 42a469aec95182b9d42adc5a52f513c9016d301e Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 09:13:03 -0500 Subject: [PATCH 16/23] CXTDT-549901 - RadioBox strike through state Signed-off-by: Matt Bruce --- VDS/Components/RadioBox/RadioBoxGroup.swift | 8 +++++++- VDS/Components/RadioBox/RadioBoxItem.swift | 7 ++++--- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/VDS/Components/RadioBox/RadioBoxGroup.swift b/VDS/Components/RadioBox/RadioBoxGroup.swift index b31bcb0e..18d3c26b 100644 --- a/VDS/Components/RadioBox/RadioBoxGroup.swift +++ b/VDS/Components/RadioBox/RadioBoxGroup.swift @@ -49,6 +49,8 @@ open class RadioBoxGroup: SelectorGroupBase, SelectorGroupSingleSe $0.isEnabled = !model.disabled $0.inputId = model.inputId $0.isSelected = model.selected + $0.strikethrough = model.strikethrough + $0.strikethroughAccessibilityText = model.strikethroughAccessibileText } } } @@ -115,12 +117,14 @@ extension RadioBoxGroup { /// Array of LabelAttributeModel objects used in rendering the subTextRight. public var subTextRightAttributes: [any LabelAttributeModel]? public var selected: Bool + public var strikethrough: Bool = false + public var strikethroughAccessibileText: String public init(disabled: Bool, surface: Surface = .light, inputId: String? = nil, value: AnyHashable? = nil, text: String = "", textAttributes: [any LabelAttributeModel]? = nil, subText: String? = nil, subTextAttributes: [any LabelAttributeModel]? = nil, subTextRight: String? = nil, subTextRightAttributes: [any LabelAttributeModel]? = nil, - selected: Bool = false, errorText: String? = nil, accessibileText: String? = nil) { + selected: Bool = false, errorText: String? = nil, accessibileText: String? = nil, strikethrough: Bool = false, strikethroughAccessibileText: String = "not available") { self.disabled = disabled self.surface = surface self.inputId = inputId @@ -133,6 +137,8 @@ extension RadioBoxGroup { self.subTextRightAttributes = subTextRightAttributes self.selected = selected self.accessibileText = accessibileText + self.strikethrough = strikethrough + self.strikethroughAccessibileText = strikethroughAccessibileText } public init() { diff --git a/VDS/Components/RadioBox/RadioBoxItem.swift b/VDS/Components/RadioBox/RadioBoxItem.swift index d81b68ea..23dd2b41 100644 --- a/VDS/Components/RadioBox/RadioBoxItem.swift +++ b/VDS/Components/RadioBox/RadioBoxItem.swift @@ -123,6 +123,8 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { /// If provided, the radio box will be rendered to show the option with a strikethrough. open var strikethrough: Bool = false { didSet { setNeedsUpdate() } } + open var strikethroughAccessibilityText: String = "not available" { didSet { setNeedsUpdate() } } + open var inputId: String? { didSet { setNeedsUpdate() } } open var value: AnyHashable? { didSet { setNeedsUpdate() } } @@ -236,9 +238,8 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { /// Used to update any Accessibility properties. open override func updateAccessibility() { super.updateAccessibility() - if accessibilityLabel == nil { - setAccessibilityLabel(for: [textLabel, subTextLabel, subTextRightLabel]) - } + setAccessibilityLabel(for: [textLabel, subTextLabel, subTextRightLabel]) + accessibilityValue = strikethrough ? strikethroughAccessibilityText : nil } //-------------------------------------------------- diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 7989a4fe..70fd4153 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -5,6 +5,7 @@ - CXTDT-547200 - Carousel scrollbar – Accessibility - The scrollbar is receiving right/ left swipe focus - CXTDT-549888 - Pagination - Accessibility - Next/Previous - CXTDT-542333 - RadioBox Padding +- CXTDT-549901 - RadioBox strike through state 1.0.59 ---------------- From a04f9a14df220dbc04934f511b7020d047bd077d Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 09:29:50 -0500 Subject: [PATCH 17/23] fixed bug in selector base Signed-off-by: Matt Bruce --- VDS/BaseClasses/Selector/SelectorBase.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/VDS/BaseClasses/Selector/SelectorBase.swift b/VDS/BaseClasses/Selector/SelectorBase.swift index 38d087cc..161f979d 100644 --- a/VDS/BaseClasses/Selector/SelectorBase.swift +++ b/VDS/BaseClasses/Selector/SelectorBase.swift @@ -114,6 +114,12 @@ open class SelectorBase: Control, SelectorControlable { accessibilityTraits = .button } + open override func updateView() { + super.updateView() + setNeedsLayout() + layoutIfNeeded() + } + /// Used to update any Accessibility properties.ß open override func updateAccessibility() { super.updateAccessibility() From 80233b6797a2faea895a1d5e90224db7607f4afd Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 09:52:39 -0500 Subject: [PATCH 18/23] added error state in the accessibilityLabel Signed-off-by: Matt Bruce --- VDS/BaseClasses/Selector/SelectorBase.swift | 1 + VDS/BaseClasses/Selector/SelectorItemBase.swift | 2 +- VDS/Components/Checkbox/Checkbox.swift | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VDS/BaseClasses/Selector/SelectorBase.swift b/VDS/BaseClasses/Selector/SelectorBase.swift index 161f979d..0b29f4e2 100644 --- a/VDS/BaseClasses/Selector/SelectorBase.swift +++ b/VDS/BaseClasses/Selector/SelectorBase.swift @@ -123,6 +123,7 @@ open class SelectorBase: Control, SelectorControlable { /// Used to update any Accessibility properties.ß open override func updateAccessibility() { super.updateAccessibility() + accessibilityLabel = "\(Self.self)\(showError ? ", error" : "")" } /// This will change the state of the Selector and execute the actionBlock if provided. diff --git a/VDS/BaseClasses/Selector/SelectorItemBase.swift b/VDS/BaseClasses/Selector/SelectorItemBase.swift index 9eee8f29..495ffaf3 100644 --- a/VDS/BaseClasses/Selector/SelectorItemBase.swift +++ b/VDS/BaseClasses/Selector/SelectorItemBase.swift @@ -190,7 +190,7 @@ open class SelectorItemBase: Control, Errorable, /// Used to update any Accessibility properties. open override func updateAccessibility() { super.updateAccessibility() - setAccessibilityLabel(for: [label, childLabel, errorLabel]) + setAccessibilityLabel(for: [selectorView, label, childLabel, errorLabel]) } /// Resets to default settings. diff --git a/VDS/Components/Checkbox/Checkbox.swift b/VDS/Components/Checkbox/Checkbox.swift index d9ca8a7e..550b6db1 100644 --- a/VDS/Components/Checkbox/Checkbox.swift +++ b/VDS/Components/Checkbox/Checkbox.swift @@ -42,7 +42,6 @@ open class Checkbox: SelectorBase { /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open override func setup() { super.setup() - accessibilityLabel = "Checkbox" backgroundColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .selected) backgroundColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: [.selected, .highlighted]) @@ -71,7 +70,7 @@ open class Checkbox: SelectorBase { isSelected.toggle() sendActions(for: .valueChanged) } - + open override func layoutSubviews() { super.layoutSubviews() From 07110ed5cc9e2887dc4d8e359c02b12702d497c6 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 11:16:09 -0500 Subject: [PATCH 19/23] updated for error and resign first responder Signed-off-by: Matt Bruce --- .../TextFields/EntryFieldBase.swift | 1 + .../TextFields/InputField/InputField.swift | 22 ++++++++++++++++++- .../TextFields/TextArea/TextArea.swift | 10 +++++++++ .../TextFields/TextArea/TextView.swift | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index 9f7cf49d..a8ad917a 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -129,6 +129,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { open var errorLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textStyle = .bodySmall + $0.accessibilityValue = "error" } open var helperLabel = Label().with { diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index 004b33ae..e34ee01c 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -151,7 +151,8 @@ open class InputField: EntryFieldBase, UITextFieldDelegate { /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open override func setup() { super.setup() - + isAccessibilityElement = false + minWidthConstraint = containerView.widthAnchor.constraint(greaterThanOrEqualToConstant: 0) minWidthConstraint?.isActive = true @@ -272,6 +273,25 @@ open class InputField: EntryFieldBase, UITextFieldDelegate { } } + /// Used to update any Accessibility properties. + open override func updateAccessibility() { + super.updateAccessibility() + textField.accessibilityLabel = showError ? "error" : nil + if showError { + accessibilityElements = [titleLabel, textField, icon, errorLabel, helperLabel] + } else { + accessibilityElements = [titleLabel, textField, helperLabel] + } + } + + open override var canBecomeFirstResponder: Bool { true } + + open override func resignFirstResponder() -> Bool { + if textField.isFirstResponder { + textField.resignFirstResponder() + } + return super.resignFirstResponder() + } } extension InputField.FieldType { diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index b8f0e009..d057333b 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -239,6 +239,7 @@ open class TextArea: EntryFieldBase { /// Used to update any Accessibility properties. open override func updateAccessibility() { super.updateAccessibility() + textView.accessibilityLabel = showError ? "error" : nil if showError { accessibilityElements = [titleLabel, textView, icon, errorLabel, helperLabel] } else { @@ -246,6 +247,15 @@ open class TextArea: EntryFieldBase { } } + open override var canBecomeFirstResponder: Bool { true } + + open override func resignFirstResponder() -> Bool { + if textView.isFirstResponder { + textView.resignFirstResponder() + } + return super.resignFirstResponder() + } + //-------------------------------------------------- // MARK: - Private Methods //-------------------------------------------------- diff --git a/VDS/Components/TextFields/TextArea/TextView.swift b/VDS/Components/TextFields/TextArea/TextView.swift index d461ee23..c35b4a80 100644 --- a/VDS/Components/TextFields/TextArea/TextView.swift +++ b/VDS/Components/TextFields/TextArea/TextView.swift @@ -147,5 +147,6 @@ open class TextView: UITextView, ViewProtocol { attributedText = nil } } + } From f65cc2115ba57cf9c83147f082b911de9c6f8639 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 12:39:25 -0500 Subject: [PATCH 20/23] CXTDT-546824 - Notification Status / Close icon Signed-off-by: Matt Bruce --- VDS/Components/Notification/Notification.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Notification/Notification.swift b/VDS/Components/Notification/Notification.swift index f91d45ef..241efb34 100644 --- a/VDS/Components/Notification/Notification.swift +++ b/VDS/Components/Notification/Notification.swift @@ -264,8 +264,6 @@ open class Notification: View { isAccessibilityElement = false accessibilityElements = [closeButton, typeIcon, titleLabel, subTitleLabel, buttonGroup] closeButton.accessibilityTraits = [.button] - closeButton.accessibilityLabel = "Close Notification" - } /// Resets to default settings. @@ -325,7 +323,6 @@ open class Notification: View { let iconColor = surface == .dark ? VDSColor.paletteWhite : VDSColor.paletteBlack typeIcon.name = style.iconName typeIcon.color = iconColor - typeIcon.accessibilityLabel = style.accessibilityText closeButton.color = iconColor closeButton.isHidden = hideCloseButton } @@ -374,6 +371,12 @@ open class Notification: View { } } + open override func updateAccessibility() { + super.updateAccessibility() + closeButton.accessibilityLabel = "Close Notification" + typeIcon.accessibilityLabel = style.accessibilityText + } + private func setConstraints() { labelViewAndButtonViewConstraint?.deactivate() labelViewBottomConstraint?.deactivate() From d6306712153484d517ad6fbf24c5ddfc4cb966a9 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 12:40:13 -0500 Subject: [PATCH 21/23] release notes updated Signed-off-by: Matt Bruce --- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 70fd4153..855ef058 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -6,6 +6,7 @@ - CXTDT-549888 - Pagination - Accessibility - Next/Previous - CXTDT-542333 - RadioBox Padding - CXTDT-549901 - RadioBox strike through state +- CXTDT-546824 - Notification - Accessibility - Improper label for close notification button & icon 1.0.59 ---------------- From f7f0fcbff1413fe6d95b38f29c35881dd1276c89 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 13:07:46 -0500 Subject: [PATCH 22/23] 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 f805c10f..308c7f47 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -1377,7 +1377,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 59; + CURRENT_PROJECT_VERSION = 60; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1414,7 +1414,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 59; + CURRENT_PROJECT_VERSION = 60; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; From f7af3e52f1b98a43ab6efbba61f4179983963122 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Mon, 29 Apr 2024 15:20:09 -0400 Subject: [PATCH 23/23] Digital PCT265 story ONEAPP-7249 - Better once implementation to avoid mutex lockups. --- VDS/Extensions/DispatchQueue+Once.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/VDS/Extensions/DispatchQueue+Once.swift b/VDS/Extensions/DispatchQueue+Once.swift index 092500cf..15c96e41 100644 --- a/VDS/Extensions/DispatchQueue+Once.swift +++ b/VDS/Extensions/DispatchQueue+Once.swift @@ -8,7 +8,7 @@ import Foundation extension DispatchQueue { - private static var _onceTracker = [String]() + private static var _onceTracker = Set() public class func once( file: String = #file, @@ -31,12 +31,17 @@ extension DispatchQueue { token: String, block: () -> Void ) { + // Peek ahead to avoid the intersection. + guard !_onceTracker.contains(token) else { return } + objc_sync_enter(self) defer { objc_sync_exit(self) } + // Double check we are the first in the critical section. guard !_onceTracker.contains(token) else { return } - _onceTracker.append(token) + // Execute. + _onceTracker.insert(token) block() } }