From d7c472b667d9bb0eb3d6f9d193e4c7651e628a6c Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Fri, 15 Sep 2023 01:07:20 +0530 Subject: [PATCH 1/8] added accessibilitytraits, value, label dynamically from modelJSON --- .../Device/ListDeviceComplexButtonMedium.swift | 1 + .../Device/ListDeviceComplexButtonSmall.swift | 1 + .../ListLeftVariableIconAllTextLinks.swift | 2 +- .../ListLeftVariableIconWithRightCaret.swift | 2 +- ...ariableIconWithRightCaretAllTextLinks.swift | 2 +- ...eftVariableIconWithRightCaretBodyText.swift | 2 +- ...ftVariableNumberedListAllTextAndLinks.swift | 2 +- .../ListLeftVariableNumberedListBodyText.swift | 2 +- .../List/ListProgressBarThin.swift | 2 +- .../List/Miscellaneous/ListStoreLocator.swift | 2 +- ...OneColumnFullWidthTextAllTextAndLinks.swift | 2 +- .../ListOneColumnFullWidthTextBodyText.swift | 2 +- .../List/RightVariable/ListRVWheel.swift | 2 +- ...istRightVariableButtonAllTextAndLinks.swift | 2 +- .../ListRightVariablePayments.swift | 2 +- ...ghtVariablePriceChangeAllTextAndLinks.swift | 2 +- .../ListRightVariablePriceChangeBodyText.swift | 2 +- ...ightVariableRightCaretAlltextAndLinks.swift | 4 ++-- ...tRightVariableTextLinkAllTextAndLinks.swift | 2 +- .../ListRightVariableTotalData.swift | 2 +- .../Atomic/Molecules/Items/ListItemModel.swift | 14 +++++++++++++- .../AccessibilityModelProtocol.swift | 18 ++++++++++++++++++ .../ModelProtocols/ListItemModelProtocol.swift | 2 +- MVMCoreUI/BaseClasses/TableViewCell.swift | 9 +++++++++ 24 files changed, 62 insertions(+), 21 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift index 7a9e8b7e..3dae857d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift @@ -75,6 +75,7 @@ import Foundation delegateObject, additionalData) rightImageView.set(with: model.image, delegateObject, additionalData) updateAccessibilityLabel() + accessibilityTraits.update(with: model.accessibilityTraits ?? button.accessibilityTraits) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift index 7f47929f..b2981158 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift @@ -73,6 +73,7 @@ delegateObject, additionalData) rightImageView.set(with: model.image, delegateObject, additionalData) updateAccessibilityLabel() + accessibilityTraits.update(with: model.accessibilityTraits ?? button.accessibilityTraits) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index 728d8464..ac3d2681 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -77,7 +77,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 8ffbf06c..2edda50e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift index 0c09e9e3..e062fa53 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift @@ -99,7 +99,7 @@ func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index 6174fc4b..d050574c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -109,6 +109,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index 75096854..d133b035 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -87,7 +87,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index 1fff77d1..1cad67b4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -89,7 +89,7 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index 9b85dc4f..d612ef48 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -131,6 +131,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift index 1e271e87..47f37250 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift @@ -147,7 +147,7 @@ override public var accessibilityTraits: UIAccessibilityTraits { get { if (accessoryView != nil) { - return .button + return listItemModel?.accessibilityTraits ?? .button } else if (!(horizontalStack.stackModel?.molecules[1].gone ?? true)) { return heart.accessibilityTraits } else { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 6e5a7245..bc715483 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -95,7 +95,7 @@ import Foundation // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return (accessoryView != nil) ? .button : .none + return (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index 7a17dd1b..764a60f2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -46,7 +46,7 @@ import Foundation /// Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return (accessoryView != nil) ? .button : .none + return (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index 46c11747..0c08b71b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index bca4696a..999f2e40 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -47,7 +47,7 @@ stack.restack() accessibilityValue = button.accessibilityValue accessibilityHint = button.accessibilityHint - accessibilityTraits = .button + accessibilityTraits = (listItemModel?.accessibilityTraits ?? .button) } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index ae482d8d..565b5c4d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -83,6 +83,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index d0b2ff70..e5de7b41 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -100,7 +100,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index a03b676d..d7f90345 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -98,6 +98,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 12f11b9e..51fd0378 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -97,8 +97,8 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none - + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift index e47cae46..d7851519 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -89,7 +89,7 @@ func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 - accessibilityTraits = .button + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index a749041a..407eeacf 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -95,6 +95,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift index a5320ad2..177550d2 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift @@ -18,7 +18,10 @@ public var hideArrow: Bool? public var line: LineModel? public var style: ListItemStyle? - + public var accessibilityTraits: UIAccessibilityTraits? + public var accessibilityText: String? + public var accessibilityValue: String? + //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- @@ -29,6 +32,9 @@ case hideArrow case line case style + case accessibilityTraits + case accessibilityText + case accessibilityValue } //-------------------------------------------------- @@ -102,6 +108,9 @@ hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) style = try typeContainer.decodeIfPresent(ListItemStyle.self, forKey: .style) + accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) + accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) + accessibilityValue = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityValue) try super.init(from: decoder) } @@ -113,5 +122,8 @@ try container.encodeIfPresent(hideArrow, forKey: .hideArrow) try container.encodeIfPresent(line, forKey: .line) try container.encodeIfPresent(style, forKey: .style) + try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) + try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) + try container.encodeIfPresent(accessibilityValue, forKey: .accessibilityValue) } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift index a7508e39..809334d8 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift @@ -12,6 +12,9 @@ import Foundation public protocol AccessibilityModelProtocol { var accessibilityIdentifier: String? { get set } + var accessibilityTraits: UIAccessibilityTraits? { get set } + var accessibilityText: String? { get set } + var accessibilityValue: String? { get set } } public extension AccessibilityModelProtocol { @@ -20,4 +23,19 @@ public extension AccessibilityModelProtocol { get { nil } set { } } + + var accessibilityTraits: UIAccessibilityTraits? { + get { nil } + set { } + } + + var accessibilityText: String? { + get { nil } + set { } + } + + var accessibilityValue: String? { + get { nil } + set { } + } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift index 3c64fdb4..b3b7be7e 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift @@ -15,7 +15,7 @@ public enum ListItemStyle: String, Codable { case none } -public protocol ListItemModelProtocol: ContainerModelProtocol { +public protocol ListItemModelProtocol: ContainerModelProtocol, AccessibilityModelProtocol { var line: LineModel? { get set } var action: ActionModelProtocol? { get set } var hideArrow: Bool? { get set } diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index c21e2c49..f5bb8bf1 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -163,6 +163,15 @@ import UIKit // align if needed. containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol) + + if let traits = model.accessibilityTraits { + accessibilityTraits.update(with: traits) + } + if let accessibilityText = model.accessibilityText { + accessibilityLabel = accessibilityText + isAccessibilityElement = true + } + accessibilityValue = model.accessibilityValue } open func reset() { From eb9ec0086618709faf73c85268ace4eeb092ca8a Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Fri, 15 Sep 2023 01:17:53 +0530 Subject: [PATCH 2/8] updated button traits dynamically --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 4 ++++ MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift | 4 +++- MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift | 6 ++++-- MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index 08afefde..ce5a846e 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -73,6 +73,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat _backgroundColor = newValue } } + public var accessibilityTraits: UIAccessibilityTraits? //-------------------------------------------------- // MARK: - Methods @@ -195,6 +196,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat case disabledTextColor case disabledBorderColor case width + case accessibilityTraits } //-------------------------------------------------- @@ -263,6 +265,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width) + accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) } open func encode(to encoder: Encoder) throws { @@ -286,5 +289,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat try container.encodeIfPresent(size, forKey: .size) try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(width, forKey: .width) + try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift index 323236a7..394f7d86 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift @@ -33,7 +33,9 @@ import Foundation super.set(with: model, delegateObject, additionalData) FormValidator.setupValidation(for: castModel, delegate: delegateObject?.formHolderDelegate) - + if let traits = model.accessibilityTraits { + accessibilityTraits = traits + } } public func setState() { diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift index a61ec150..75b6c923 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift @@ -24,7 +24,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro public var enabled: Bool = true public var enabledTintColor: Color? public var disabledTintColor: Color? - + public var accessibilityTraits: UIAccessibilityTraits? public var groupName: String = "" public var updateUI: ActionBlock? @@ -45,6 +45,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro case groupName case enabledTintColor case disabledTintColor + case accessibilityTraits } //-------------------------------------------------- @@ -59,7 +60,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) action = try typeContainer.decodeModel(codingKey: .action) - + accessibilityTraits = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityTraits) if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled } @@ -90,5 +91,6 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(enabledTintColor, forKey: .enabledTintColor) try container.encodeIfPresent(disabledTintColor, forKey: .disabledTintColor) + try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index e578fa51..71d5c332 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -173,6 +173,9 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { } FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) + if let traits = model.accessibilityTraits { + accessibilityTraits = traits + } } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { From 14ac43d0eaedcf3f478e7936fe33dc7664f7e089 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 15 Sep 2023 16:34:28 +0530 Subject: [PATCH 3/8] Update ImageButtonModel.swift --- MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift index 75b6c923..74325d85 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift @@ -60,7 +60,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) action = try typeContainer.decodeModel(codingKey: .action) - accessibilityTraits = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityTraits) + accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled } From c972597a117a01bc333b138f3e7f4df2041e3d5a Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 13 Oct 2023 23:31:18 +0530 Subject: [PATCH 4/8] Addressed review comments --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 8 ++++++++ MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift | 2 +- MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 8 ++++---- .../LeftVariable/ListLeftVariableIconWithRightCaret.swift | 2 +- .../ListLeftVariableIconWithRightCaretAllTextLinks.swift | 2 +- .../ListLeftVariableIconWithRightCaretBodyText.swift | 2 +- .../ListLeftVariableNumberedListAllTextAndLinks.swift | 2 +- .../ListLeftVariableNumberedListBodyText.swift | 2 +- .../DesignedComponents/List/ListProgressBarThin.swift | 2 +- .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 2 +- .../OneColumn/ListOneColumnFullWidthTextBodyText.swift | 2 +- .../List/RightVariable/ListRVWheel.swift | 2 +- .../List/RightVariable/ListRightVariablePayments.swift | 2 +- .../ListRightVariablePriceChangeAllTextAndLinks.swift | 2 +- .../ListRightVariablePriceChangeBodyText.swift | 2 +- .../ListRightVariableRightCaretAlltextAndLinks.swift | 2 +- .../List/RightVariable/ListRightVariableTotalData.swift | 2 +- 17 files changed, 27 insertions(+), 19 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index ce5a846e..e455589b 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -74,6 +74,8 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat } } public var accessibilityTraits: UIAccessibilityTraits? + public var disabledAccessibilityTraits: UIAccessibilityTraits? + public var isAccessibilityElement: Bool? //-------------------------------------------------- // MARK: - Methods @@ -197,6 +199,8 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat case disabledBorderColor case width case accessibilityTraits + case disabledAccessibilityTraits + case isAccessibilityElement } //-------------------------------------------------- @@ -266,6 +270,8 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width) accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) + disabledAccessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .disabledAccessibilityTraits) + isAccessibilityElement = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAccessibilityElement) } open func encode(to encoder: Encoder) throws { @@ -290,5 +296,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(width, forKey: .width) try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) + try container.encodeIfPresent(disabledAccessibilityTraits, forKey: .disabledAccessibilityTraits) + try container.encodeIfPresent(isAccessibilityElement, forKey: .isAccessibilityElement) } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift index 74325d85..8f4bb522 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift @@ -60,7 +60,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) action = try typeContainer.decodeModel(codingKey: .action) - accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) + accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) ?? .button if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index 71d5c332..f4b3e257 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -101,7 +101,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { #if DEBUG // Useful to detect with isHittable when performing UI testing. - isAccessibilityElement = isEnabled + isAccessibilityElement = model?.isAccessibilityElement ?? isEnabled #endif if isEnabled { @@ -134,6 +134,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { case .standard: verticalPadding = Padding.Three horizontalPadding = Padding.Five + break case .small: verticalPadding = Padding.Two @@ -173,9 +174,8 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { } FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) - if let traits = model.accessibilityTraits { - accessibilityTraits = traits - } + accessibilityTraits = isEnabled ? (model.accessibilityTraits ?? .button) : (model.disabledAccessibilityTraits ?? .none) + } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 2edda50e..2a2adb27 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift index e062fa53..d65e35e5 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift @@ -99,7 +99,7 @@ func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index d050574c..70c8ea60 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -109,6 +109,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index d133b035..cf119b33 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -87,7 +87,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index 1cad67b4..4a6667df 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -89,7 +89,7 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index d612ef48..ab8eee78 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -131,6 +131,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index bc715483..0fece30a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -95,7 +95,7 @@ import Foundation // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + return listItemModel?.accessibilityTraits ?? .button } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index da77d173..e62ce891 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -46,7 +46,7 @@ import Foundation /// Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + return listItemModel?.accessibilityTraits ?? .button } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index 0c08b71b..cbd9741d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 565b5c4d..eeb09ee5 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -83,6 +83,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index e5de7b41..6ed847a9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -100,7 +100,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index d7f90345..7fafd3f0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -98,6 +98,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 51fd0378..6b059dbc 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -97,7 +97,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index 407eeacf..cd7a6db9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -95,6 +95,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } From fb760bf91e84f4519923995ba18895f7f60999da Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 20 Oct 2023 00:18:29 +0530 Subject: [PATCH 5/8] Added dynamic trait for ListStoreLocator --- .../List/Miscellaneous/ListStoreLocator.swift | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift index 47f37250..3c69d6a4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift @@ -146,13 +146,7 @@ // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - if (accessoryView != nil) { - return listItemModel?.accessibilityTraits ?? .button - } else if (!(horizontalStack.stackModel?.molecules[1].gone ?? true)) { - return heart.accessibilityTraits - } else { - return .none - } + return listItemModel?.accessibilityTraits ?? .button } set { } } From 43f1c64151005291522509a570ad5489739a48bd Mon Sep 17 00:00:00 2001 From: Keerthy Date: Thu, 26 Oct 2023 18:44:51 +0530 Subject: [PATCH 6/8] updated logic --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 4 ---- MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift | 6 +++--- MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 4 ++-- .../LeftVariable/ListLeftVariableIconAllTextLinks.swift | 2 +- .../LeftVariable/ListLeftVariableIconWithRightCaret.swift | 2 +- .../ListLeftVariableIconWithRightCaretAllTextLinks.swift | 2 +- .../ListLeftVariableIconWithRightCaretBodyText.swift | 2 +- .../ListLeftVariableNumberedListAllTextAndLinks.swift | 2 +- .../LeftVariable/ListLeftVariableNumberedListBodyText.swift | 2 +- .../DesignedComponents/List/ListProgressBarThin.swift | 2 +- .../List/Miscellaneous/ListStoreLocator.swift | 2 +- .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 3 ++- .../List/OneColumn/ListOneColumnFullWidthTextBodyText.swift | 2 +- .../DesignedComponents/List/RightVariable/ListRVWheel.swift | 2 +- .../List/RightVariable/ListRightVariablePayments.swift | 2 +- .../ListRightVariablePriceChangeAllTextAndLinks.swift | 2 +- .../ListRightVariablePriceChangeBodyText.swift | 2 +- .../ListRightVariableRightCaretAlltextAndLinks.swift | 2 +- .../List/RightVariable/ListRightVariableTotalData.swift | 2 +- .../NavigationController/NavigationController.swift | 4 ++++ .../MVMCoreUISplitViewController+Extension.swift | 4 ++++ MVMCoreUI/Managers/SubNav/SubNavManagerController.swift | 4 ++++ 22 files changed, 34 insertions(+), 25 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index e455589b..c06d31fc 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -75,7 +75,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat } public var accessibilityTraits: UIAccessibilityTraits? public var disabledAccessibilityTraits: UIAccessibilityTraits? - public var isAccessibilityElement: Bool? //-------------------------------------------------- // MARK: - Methods @@ -200,7 +199,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat case width case accessibilityTraits case disabledAccessibilityTraits - case isAccessibilityElement } //-------------------------------------------------- @@ -271,7 +269,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width) accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) disabledAccessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .disabledAccessibilityTraits) - isAccessibilityElement = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAccessibilityElement) } open func encode(to encoder: Encoder) throws { @@ -297,6 +294,5 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat try container.encodeIfPresent(width, forKey: .width) try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) try container.encodeIfPresent(disabledAccessibilityTraits, forKey: .disabledAccessibilityTraits) - try container.encodeIfPresent(isAccessibilityElement, forKey: .isAccessibilityElement) } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift index 394f7d86..f3dc2798 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift @@ -33,9 +33,6 @@ import Foundation super.set(with: model, delegateObject, additionalData) FormValidator.setupValidation(for: castModel, delegate: delegateObject?.formHolderDelegate) - if let traits = model.accessibilityTraits { - accessibilityTraits = traits - } } public func setState() { @@ -49,6 +46,9 @@ import Foundation } else if let disabledTintColor = castModel.disabledTintColor { image.imageView.tintColor = disabledTintColor.uiColor } + if let traits = model?.accessibilityTraits { + accessibilityTraits = traits + } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index f4b3e257..579236e9 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -101,7 +101,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { #if DEBUG // Useful to detect with isHittable when performing UI testing. - isAccessibilityElement = model?.isAccessibilityElement ?? isEnabled + isAccessibilityElement = isEnabled #endif if isEnabled { @@ -121,6 +121,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { self.borderColor = borderColor } } + accessibilityTraits = isEnabled ? (model?.accessibilityTraits ?? .button) : (model?.disabledAccessibilityTraits ?? .none) } private func getInnerPadding() -> CGFloat { @@ -174,7 +175,6 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { } FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) - accessibilityTraits = isEnabled ? (model.accessibilityTraits ?? .button) : (model.disabledAccessibilityTraits ?? .none) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index ac3d2681..b9d234bb 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -77,7 +77,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 2a2adb27..cd1b20d9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift index d65e35e5..48d4affe 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift @@ -99,7 +99,7 @@ func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index 70c8ea60..cf83dcd9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -109,6 +109,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index cf119b33..d4e9b6ce 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -87,7 +87,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index 4a6667df..ea81bc55 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -89,7 +89,7 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index ab8eee78..b3861703 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -131,6 +131,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift index 3c69d6a4..d1ccd921 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift @@ -146,7 +146,7 @@ // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return listItemModel?.accessibilityTraits ?? .button + return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } set { } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 0fece30a..d2177ede 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -95,7 +95,8 @@ import Foundation // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return listItemModel?.accessibilityTraits ?? .button + return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) + } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index e62ce891..ff14df7f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -46,7 +46,7 @@ import Foundation /// Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return listItemModel?.accessibilityTraits ?? .button + return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index cbd9741d..be3f7370 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index eeb09ee5..a662a587 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -83,6 +83,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index 6ed847a9..f11c7278 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -100,7 +100,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index 7fafd3f0..b13a389e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -98,6 +98,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 6b059dbc..37af1350 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -97,7 +97,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index cd7a6db9..345feca1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -95,6 +95,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Containers/NavigationController/NavigationController.swift b/MVMCoreUI/Containers/NavigationController/NavigationController.swift index 8f72a792..5226ee87 100644 --- a/MVMCoreUI/Containers/NavigationController/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController/NavigationController.swift @@ -83,6 +83,10 @@ import Combine } extension NavigationController: MVMCoreViewManagerProtocol { + public func getAccessibilityElements() -> [Any]? { + return [] + } + public func getCurrentViewController() -> UIViewController? { guard let topViewController = topViewController else { return nil } return MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index 20f4449c..b15a90aa 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -249,6 +249,10 @@ public extension MVMCoreUISplitViewController { } extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol { + public func getAccessibilityElements() -> [Any]? { + return [] + } + public func getCurrentViewController() -> UIViewController? { navigationController?.getCurrentViewController() } diff --git a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift index 458c0169..32ded335 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift @@ -10,6 +10,10 @@ import Foundation import MVMCore open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, TabsDelegate, MVMCorePresentationDelegateProtocol, SubNavSwipeNavigationProtocol { + public func getAccessibilityElements() -> [Any]? { + return [] + } + /// The current managed view controller private var viewController: UIViewController From 1e5578a66cfc7934066f0a3482977287146a9372 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Thu, 26 Oct 2023 22:06:55 +0530 Subject: [PATCH 7/8] discarded unwanted changes --- MVMCoreUI/Managers/SubNav/SubNavManagerController.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift index 32ded335..458c0169 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift @@ -10,10 +10,6 @@ import Foundation import MVMCore open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, TabsDelegate, MVMCorePresentationDelegateProtocol, SubNavSwipeNavigationProtocol { - public func getAccessibilityElements() -> [Any]? { - return [] - } - /// The current managed view controller private var viewController: UIViewController From eb5d3593228cc556ee48af6bdf84ae9c23c1c661 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Mon, 22 Jan 2024 23:29:47 +0530 Subject: [PATCH 8/8] Addressed review comments Added accessibilityHint to AccessibilityModelProtocol --- .../ModelProtocols/AccessibilityModelProtocol.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift index 809334d8..b233c71d 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift @@ -15,6 +15,7 @@ public protocol AccessibilityModelProtocol { var accessibilityTraits: UIAccessibilityTraits? { get set } var accessibilityText: String? { get set } var accessibilityValue: String? { get set } + var accessibilityHint: String? { get set } } public extension AccessibilityModelProtocol { @@ -38,4 +39,9 @@ public extension AccessibilityModelProtocol { get { nil } set { } } + + var accessibilityHint: String? { + get { nil } + set {} + } }