From 17a14e0634cdf2475c2f657ddf60f01e35a49f7a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 14:43:01 -0400 Subject: [PATCH 01/14] Update accessibility for numberd left variable --- ...tVariableNumberedListAllTextAndLinks.swift | 59 ++++++------------- .../EyebrowHeadlineBodyLink.swift | 40 +++++++++++++ 2 files changed, 59 insertions(+), 40 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index 5924b3d7..6b133172 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -40,7 +40,6 @@ import Foundation leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) addMolecule(stack) stack.restack() - updateAccessibilityLabel() } //--------------------------------------------------- @@ -76,56 +75,36 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- + func getAccessibilityMessage() -> String { + guard let leftLabel = leftLabel.text else { + return eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + return leftLabel + ", " + eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + func updateAccessibilityLabel() { - - var message = "" - - if let leftLabel = leftLabel.text { - message += leftLabel + ", " - } - - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { - message += eyebrowLabel + ", " - } - - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { - message += headlineLabel + ", " - } - - if let bodyLabel = eyebrowHeadlineBodyLink.body.text { - message += bodyLabel - } - + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - if !linkShowing { // Make whole cell focusable if no link. - accessibilityLabel = message + accessibilityLabel = getAccessibilityMessage() + accessibilityElements = nil + } else if let accessoryView = accessoryView { + // Both caret and link. Read all content on caret. + accessoryView.accessibilityLabel = getAccessibilityMessage() + accessibilityElements = [accessoryView, eyebrowHeadlineBodyLink.link] } else { - var elements: [UIView] = [] - + // Only link. Manually add accessibility elements to ensure they are read in the right order. + var elements: [Any] = [] if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty { elements.append(leftLabel) } - - if let eyeBrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyeBrowText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.eyebrow) + if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { + elements.append(otherElements) } - - if let headlineText = eyebrowHeadlineBodyLink.headline.text, !headlineText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.headline) - } - - if let bodyText = eyebrowHeadlineBodyLink.body.text, !bodyText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.body) - } - - if linkShowing { - elements.append(eyebrowHeadlineBodyLink.link) - } - accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index 7d176ba2..8a4d6d38 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -69,4 +69,44 @@ import UIKit open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 65 } + + //-------------------------------------------------- + // MARK: - Accessibility Helpers + //-------------------------------------------------- + + /// Returns the labels text in one message. + func getAccessibilityMessage() -> String { + var message = "" + + if let eyebrowLabel = eyebrow.text { + message += eyebrowLabel + ", " + } + + if let headlineLabel = headline.text { + message += headlineLabel + ", " + } + + if let bodyLabel = body.text { + message += bodyLabel + } + return message + } + + /// Returns an array of the appropriate accessibility elements. + func getAccessibilityElements() -> [Any]? { + var elements: [UIView] = [] + if eyebrow.hasText { + elements.append(eyebrow) + } + if headline.hasText { + elements.append(headline) + } + if body.hasText { + elements.append(body) + } + if link.titleLabel?.text?.count ?? 0 > 0 { + elements.append(link) + } + return elements.count > 0 ? elements : nil + } } From 061e9e6bd9f0eaa75f24e853a7d8e4a77cd2b572 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 15:13:53 -0400 Subject: [PATCH 02/14] left variable accessibility clean --- ...tLeftVariableCheckboxAllTextAndLinks.swift | 28 ++------- .../ListLeftVariableCheckboxBodyText.swift | 2 +- .../ListLeftVariableIconAllTextLinks.swift | 60 +++++++------------ .../ListLeftVariableIconWithRightCaret.swift | 5 +- ...ftVariableIconWithRightCaretBodyText.swift | 5 +- ...tVariableNumberedListAllTextAndLinks.swift | 7 ++- ...ftVariableRadioButtonAllTextAndLinks.swift | 25 +------- ...tVariableRadioButtonAndPaymentMethod.swift | 24 +------- .../EyebrowHeadlineBodyLink.swift | 4 +- 9 files changed, 44 insertions(+), 116 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift index ff1c6e1b..9c8976f6 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift @@ -53,7 +53,7 @@ import Foundation checkbox.isAccessibilityElement = false accessibilityTraits = checkbox.accessibilityTraits accessibilityHint = checkbox.accessibilityHint - // Update accessibility label on radio button state change. + // Update accessibility label on checkbox state change. observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() } @@ -92,16 +92,8 @@ import Foundation message += checkboxLabel + ", " } - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text, !eyebrowLabel.isEmpty { - message += eyebrowLabel + ", " - } - - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text, !headlineLabel.isEmpty { - message += headlineLabel + ", " - } - - if let bodyLabel = eyebrowHeadlineBodyLink.body.text, !bodyLabel.isEmpty { - message += bodyLabel + if let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() { + message += label } let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 @@ -114,19 +106,9 @@ import Foundation // Make whole cell focusable if no link. accessibilityLabel = message } else { - // Allow only radio button and link to be focused on. + // Allow only checkbox and link to be focused on. checkbox.accessibilityLabel = message - var elements: [UIView] = [] - - if message.count > 0 { - elements.append(checkbox) - } - - if linkShowing { - elements.append(eyebrowHeadlineBodyLink.link) - } - - accessibilityElements = elements + accessibilityElements = [checkbox, eyebrowHeadlineBodyLink.link] } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift index 326c9320..1d83cbfb 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift @@ -52,7 +52,7 @@ import Foundation checkbox.isAccessibilityElement = false accessibilityTraits = checkbox.accessibilityTraits accessibilityHint = checkbox.accessibilityHint - // Update accessibility label on radio button state change. + // Update accessibility label on checkbox state change. observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index 1f8a6a43..9e4d7533 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -42,7 +42,6 @@ import Foundation leftImage.imageView.contentMode = .scaleAspectFit addMolecule(stack) stack.restack() - updateAccessibilityLabel() } //-------------------------------------------------- @@ -63,57 +62,40 @@ import Foundation return 140 } + func getAccessibilityMessage() -> String? { + guard let leftImageLabel = leftImage.accessibilityLabel else { + return eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { + return leftImageLabel + } + return leftImageLabel + ", " + label + } + func updateAccessibilityLabel() { - var message = "" - - if let leftImageLabel = leftImage.accessibilityLabel { - message += leftImageLabel + ", " - } - - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { - message += eyebrowLabel + ", " - } - - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { - message += headlineLabel + ", " - } - - if let bodyLabel = eyebrowHeadlineBodyLink.body.text { - message += bodyLabel - } - let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing if !linkShowing { // Make whole cell focusable if no link. - accessibilityLabel = message + accessibilityLabel = getAccessibilityMessage() + accessibilityElements = nil + } else if let accessoryView = accessoryView { + // Both caret and link. Read all content on caret. + accessoryView.accessibilityLabel = getAccessibilityMessage() + accessibilityElements = [accessoryView, eyebrowHeadlineBodyLink.link] } else { - // Allow only radio button and link to be focused on. - var elements: [UIView] = [] - + // Only link. Manually add accessibility elements to ensure they are read in the right order. + var elements: [Any] = [] if let leftImageLabel = leftImage.accessibilityLabel, !leftImageLabel.isEmpty { elements.append(leftImage) } - - if let eyeBrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyeBrowText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.eyebrow) + if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { + elements.append(otherElements) } - - if let headlineText = eyebrowHeadlineBodyLink.headline.text, !headlineText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.headline) - } - - if let bodyText = eyebrowHeadlineBodyLink.body.text, !bodyText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.body) - } - - if linkShowing { - elements.append(eyebrowHeadlineBodyLink.link) - } - accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 297ef31b..821becbe 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -48,8 +48,6 @@ import UIKit rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) addMolecule(stack) stack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } //-------------------------------------------------- @@ -78,7 +76,7 @@ import UIKit } func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftImageLabel = leftImage.accessibilityLabel { @@ -94,5 +92,6 @@ import UIKit } accessibilityLabel = message + accessibilityTraits = (accessoryView != nil) ? .button : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index 0617b5e8..c416e536 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -58,10 +58,8 @@ import Foundation rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal) rightLabel.numberOfLines = 1 - isAccessibilityElement = true addMolecule(stack) stack.restack() - updateAccessibilityLabel() } //-------------------------------------------------- @@ -93,7 +91,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftImageLabel = leftImage.accessibilityLabel { @@ -113,5 +111,6 @@ import Foundation } accessibilityLabel = message + 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 6b133172..183514de 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -75,11 +75,14 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- - func getAccessibilityMessage() -> String { + func getAccessibilityMessage() -> String? { guard let leftLabel = leftLabel.text else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } - return leftLabel + ", " + eyebrowHeadlineBodyLink.getAccessibilityMessage() + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { + return leftLabel + } + return leftLabel + ", " + label } func updateAccessibilityLabel() { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift index 5756d4f5..229a2456 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift @@ -89,16 +89,8 @@ import Foundation message += radioButtonLabel + ", " } - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { - message += eyebrowLabel + ", " - } - - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { - message += headlineLabel + ", " - } - - if let bodyLabel = eyebrowHeadlineBodyLink.body.text { - message += bodyLabel + if let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() { + message += label } let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 @@ -112,18 +104,7 @@ import Foundation } else { // Allow only radio button and link to be focused on. radioButton.accessibilityLabel = message - - var elements: [UIView] = [] - - if !message.isEmpty { - elements.append(radioButton) - } - - if linkShowing { - elements.append(eyebrowHeadlineBodyLink.link) - } - - accessibilityElements = elements + accessibilityElements = [radioButton, eyebrowHeadlineBodyLink.link] } } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index 523c6d4e..6cc26352 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -107,16 +107,8 @@ import UIKit message += leftImageLabel + ", " } - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { - message += eyebrowLabel + ", " - } - - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { - message += headlineLabel + ", " - } - - if let bodyLabel = eyebrowHeadlineBodyLink.body.text { - message += bodyLabel + if let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() { + message += label } let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 @@ -130,17 +122,7 @@ import UIKit } else { // Allow only radio button and link to be focused on. radioButton.accessibilityLabel = message - var elements: [UIView] = [] - - if !message.isEmpty { - elements.append(radioButton) - } - - if linkShowing { - elements.append(eyebrowHeadlineBodyLink.link) - } - - accessibilityElements = elements + accessibilityElements = [radioButton, eyebrowHeadlineBodyLink.link] } } } diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index 8a4d6d38..12b42e9f 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -75,7 +75,7 @@ import UIKit //-------------------------------------------------- /// Returns the labels text in one message. - func getAccessibilityMessage() -> String { + func getAccessibilityMessage() -> String? { var message = "" if let eyebrowLabel = eyebrow.text { @@ -89,7 +89,7 @@ import UIKit if let bodyLabel = body.text { message += bodyLabel } - return message + return message.count > 0 ? message : nil } /// Returns an array of the appropriate accessibility elements. From 843616f75570b34002f944f9b0d0f7c458171b83 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 15:53:18 -0400 Subject: [PATCH 03/14] right variable changes --- .../List/ListProgressBarThin.swift | 5 +- .../List/RightVariable/ListRVWheel.swift | 5 +- ...stRightVariableButtonAllTextAndLinks.swift | 59 ++++++++--------- .../ListRightVariablePayments.swift | 5 +- ...htVariablePriceChangeAllTextAndLinks.swift | 61 +++++++----------- ...ListRightVariablePriceChangeBodyText.swift | 5 +- ...RightVariableTextLinkAllTextAndLinks.swift | 63 ++++++++----------- .../ListRightVariableTotalData.swift | 5 +- 8 files changed, 83 insertions(+), 125 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index 08255db9..4e0eb83a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -78,8 +78,6 @@ import Foundation stack.restack() horizontalStack.restack() labelStack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } //------------------------------------------------------ @@ -115,7 +113,7 @@ import Foundation //------------------------------------------------------ func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftHeadlineText = leftHeadline.text { @@ -135,5 +133,6 @@ import Foundation } accessibilityLabel = message + accessibilityTraits = (accessoryView != nil) ? .button : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index f410c635..58b9ada0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -41,8 +41,6 @@ import Foundation rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) addMolecule(stack) stack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } //------------------------------------------------- @@ -75,7 +73,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty { @@ -91,5 +89,6 @@ import Foundation } accessibilityLabel = message + accessibilityTraits = (accessoryView != nil) ? .button : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index 6e9503dc..c08d37cd 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -47,9 +47,9 @@ import Foundation addMolecule(stack) stack.restack() - updateAccessibilityLabel() accessibilityValue = button.accessibilityValue accessibilityHint = button.accessibilityHint + accessibilityTraits = .button } //----------------------------------------------------- @@ -74,48 +74,39 @@ import Foundation // MARK: - Accessibility //---------------------------------------------------- + func getAccessibilityMessage() -> String? { + guard let buttonText = button.titleLabel?.text else { + return eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { + return buttonText + } + return label + ", " + buttonText + } + func updateAccessibilityLabel() { - - var message = "" - - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { - message += eyebrowLabel + ", " - } - - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { - message += headlineLabel + ", " - } - - if let bodyLabel = eyebrowHeadlineBodyLink.body.text { - message += bodyLabel + ", " - } - - if let buttonLabel = button.accessibilityLabel { - message += buttonLabel - } - let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 - isAccessibilityElement = !linkShowing - button.isAccessibilityElement = linkShowing eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - - if !linkShowing { - // Make whole cell focusable if no link. - accessibilityLabel = message + button.isAccessibilityElement = linkShowing + + if !linkShowing && accessoryView == nil { + // Make whole cell focusable if one action + accessibilityLabel = getAccessibilityMessage() + accessibilityElements = nil } else { - // Allow only radio button and link to be focused on. - button.accessibilityLabel = message - var elements: [UIView] = [] - - if !message.isEmpty { - elements.append(button) + // Make buttons focusable. + var elements: [Any] = [] + if let accessoryView = accessoryView { + accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() + elements.append(accessoryView) + } else { + button.accessibilityLabel = getAccessibilityMessage() } - if linkShowing { elements.append(eyebrowHeadlineBodyLink.link) } - + elements.append(link) accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 5bb62b90..2b12a4c2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -40,8 +40,6 @@ import Foundation rightImage.addSizeConstraintsForAspectRatio = true addMolecule(stack) stack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } //---------------------------------------------------- @@ -72,7 +70,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty { @@ -84,5 +82,6 @@ import Foundation } accessibilityLabel = message + 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 afbdd2b5..76ce1a37 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -67,7 +67,6 @@ import Foundation arrow.pinHeightAndWidth() addMolecule(stack) stack.restack() - updateAccessibilityLabel() } open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { @@ -89,57 +88,39 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- + func getAccessibilityMessage() -> String? { + guard let rightLabelText = rightLabel.text else { + return eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { + return rightLabelText + } + return label + ", " + rightLabelText + } + func updateAccessibilityLabel() { - let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing if !linkShowing { // Make whole cell focusable if no link. - var message = "" - - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { - message += eyebrowLabel + ", " - } - - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { - message += headlineLabel + ", " - } - - if let bodyLabel = eyebrowHeadlineBodyLink.body.text { - message += bodyLabel + ", " - } - - if let rightLabelText = rightLabel.text { - message += rightLabelText - } - - accessibilityLabel = message - + accessibilityLabel = getAccessibilityMessage() + accessibilityElements = nil + } else if let accessoryView = accessoryView { + // Both caret and link. Read all content on caret. + accessoryView.accessibilityLabel = getAccessibilityMessage() + accessibilityElements = [accessoryView, eyebrowHeadlineBodyLink.link] } else { - var elements: [UIView] = [] - - if let eyebrowText = eyebrowHeadlineBodyLink.eyebrow.text, !eyebrowText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.eyebrow) + // Only link. Manually add accessibility elements to ensure they are read in the right order. + var elements: [Any] = [] + if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { + elements.append(otherElements) } - - if let headlineText = eyebrowHeadlineBodyLink.headline.text, !headlineText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.headline) - } - - if let bodyText = eyebrowHeadlineBodyLink.body.text, !bodyText.isEmpty { - elements.append(eyebrowHeadlineBodyLink.body) - } - - if linkShowing { - elements.append(eyebrowHeadlineBodyLink.link) - } - if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty { elements.append(rightLabel) } - accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index a93d50f9..8428dccc 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -54,8 +54,6 @@ import Foundation addMolecule(stack) stack.restack() arrowAndRightLabelStack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } //-------------------------------------------------- @@ -87,7 +85,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let headlineText = headlineBody.headlineLabel.text, !headlineText.isEmpty { @@ -103,5 +101,6 @@ import Foundation } accessibilityLabel = message + accessibilityTraits = (accessoryView != nil) ? .button : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift index 2dd2ca99..d6714f60 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -47,7 +47,6 @@ import Foundation addMolecule(stack) stack.restack() - updateAccessibilityLabel() } //-------------------------------------------------- @@ -72,52 +71,44 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- + func getAccessibilityMessage() -> String? { + guard let linkText = link.titleLabel?.text else { + return eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { + return linkText + } + return label + ", " + linkText + } + func updateAccessibilityLabel() { - - var message = "" - - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { - message += eyebrowLabel + ", " - } - - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { - message += headlineLabel + ", " - } - - if let bodyLabel = eyebrowHeadlineBodyLink.body.text { - message += bodyLabel + ", " - } - - if let linkLabel = link.accessibilityLabel { - message += linkLabel - } - let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 - isAccessibilityElement = !linkShowing - link.isAccessibilityElement = linkShowing + accessibilityTraits = .button eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - - if !linkShowing { - // Make whole cell focusable if no link. - accessibilityLabel = message + link.isAccessibilityElement = linkShowing + + if !linkShowing && accessoryView == nil { + // Make whole cell focusable if one action + accessibilityLabel = getAccessibilityMessage() + accessibilityElements = nil } else { - // Allow only radio button and link to be focused on. - link.accessibilityLabel = message - var elements: [UIView] = [] - + // Make buttons focusable. + var elements: [Any] = [] + if let accessoryView = accessoryView { + accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() + elements.append(accessoryView) + } else { + link.accessibilityLabel = getAccessibilityMessage() + } if linkShowing { elements.append(eyebrowHeadlineBodyLink.link) } - - if !message.isEmpty { - elements.append(link) - } - + elements.append(link) accessibilityElements = elements } } - + open override func accessibilityActivate() -> Bool { return link.accessibilityActivate() } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index a42cd81d..fe2c8a24 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -51,8 +51,6 @@ import Foundation rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) addMolecule(stack) stack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } //-------------------------------------------------- @@ -86,7 +84,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty { @@ -98,5 +96,6 @@ import Foundation } accessibilityLabel = message + accessibilityTraits = (accessoryView != nil) ? .button : .none } } From cdbdb907717c71c99a519092e9f3f642028e5ee5 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 16:22:12 -0400 Subject: [PATCH 04/14] accessibility columns --- .../ListDeviceComplexButtonMedium.swift | 29 ++++++++++++++----- .../Device/ListDeviceComplexButtonSmall.swift | 29 ++++++++++++++----- .../ListFourColumnDataUsageListItem.swift | 4 +-- ...neColumnFullWidthTextAllTextAndLinks.swift | 29 ++++++++++--------- .../ListOneColumnFullWidthTextBodyText.swift | 4 +-- .../ListThreeColumnDataUsage.swift | 4 +-- .../ListThreeColumnInternationalData.swift | 4 +-- .../ListTwoColumnCompareChanges.swift | 1 - .../ListTwoColumnPriceDescription.swift | 5 +--- .../TwoColumn/ListTwoColumnPriceDetails.swift | 4 +-- 10 files changed, 65 insertions(+), 48 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift index 983cfc59..0783ea99 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift @@ -58,10 +58,8 @@ import Foundation addMolecule(stack) stack.restack() verticalStack.restack() - isAccessibilityElement = true accessibilityTraits = button.accessibilityTraits accessibilityHint = button.accessibilityHint - updateAccessibilityLabel() } //-------------------------------------------------- @@ -100,10 +98,8 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- - func updateAccessibilityLabel() { - + func getAccessibilityMessage() -> String? { var message = "" - if let eyebrowText = eyebrow.text, !eyebrowText.isEmpty { message += eyebrowText + ", " } @@ -123,8 +119,27 @@ import Foundation if let rightImageViewText = rightImageView.accessibilityLabel, !rightImageViewText.isEmpty { message += rightImageViewText } - - accessibilityLabel = message + return message.count > 0 ? message : nil + } + + func updateAccessibilityLabel() { + accessibilityTraits = .button + if let accessoryView = accessoryView { + // Both caret and button. Read all content on caret. + isAccessibilityElement = false + accessoryView.accessibilityLabel = getAccessibilityMessage() + accessibilityElements = [accessoryView, button] + } else { + // Make whole cell focusable if no action. + isAccessibilityElement = true + accessibilityElements = nil + if let message = getAccessibilityMessage(), + let buttonTitle = button.titleLabel?.text { + accessibilityLabel = message + ", " + buttonTitle + } else { + accessibilityLabel = getAccessibilityMessage() + } + } } open override func accessibilityActivate() -> Bool { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift index f0ee4619..20433a45 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift @@ -58,10 +58,8 @@ import Foundation addMolecule(stack) stack.restack() verticalStack.restack() - isAccessibilityElement = true accessibilityTraits = button.accessibilityTraits accessibilityHint = button.accessibilityHint - updateAccessibilityLabel() } //-------------------------------------------------- @@ -100,10 +98,8 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- - func updateAccessibilityLabel() { - + func getAccessibilityMessage() -> String? { var message = "" - if let eyebrowText = eyebrow.text, !eyebrowText.isEmpty { message += eyebrowText + ", " } @@ -123,8 +119,27 @@ import Foundation if let rightImageViewText = rightImageView.accessibilityLabel, !rightImageViewText.isEmpty { message += rightImageViewText } - - accessibilityLabel = message + return message.count > 0 ? message : nil + } + + func updateAccessibilityLabel() { + accessibilityTraits = .button + if let accessoryView = accessoryView { + // Both caret and button. Read all content on caret. + isAccessibilityElement = false + accessoryView.accessibilityLabel = getAccessibilityMessage() + accessibilityElements = [accessoryView, button] + } else { + // Make whole cell focusable if no action. + isAccessibilityElement = true + accessibilityElements = nil + if let message = getAccessibilityMessage(), + let buttonTitle = button.titleLabel?.text { + accessibilityLabel = message + ", " + buttonTitle + } else { + accessibilityLabel = getAccessibilityMessage() + } + } } open override func accessibilityActivate() -> Bool { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift index 4ae4c4d2..8455a5bf 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift @@ -54,8 +54,6 @@ import Foundation arrow.pinHeightAndWidth() arrowAndLabel2Stack.restack() stack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } //----------------------------------------------------- @@ -92,7 +90,7 @@ import Foundation //----------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let label1Text = label1.text, !label1Text.isEmpty { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index a5d2a374..ee97a369 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -43,7 +43,6 @@ import Foundation super.setupView() addMolecule(stack) stack.restack() - updateAccessibilityLabel() } open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { @@ -72,8 +71,7 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- - func updateAccessibilityLabel() { - + func getAccessibilityMessage() -> String? { var message = "" if let eyebrowLabel = eyebrow.text, !eyebrowLabel.isEmpty { @@ -91,19 +89,26 @@ import Foundation if let bodyLabel = body.text, !bodyLabel.isEmpty { message += bodyLabel } - + return message.count > 0 ? message : nil + } + + func updateAccessibilityLabel() { + let linkShowing = link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing link.isAccessibilityElement = linkShowing if !linkShowing { // Make whole cell focusable if no link. - accessibilityLabel = message + accessibilityLabel = getAccessibilityMessage() + accessibilityElements = nil + } else if let accessoryView = accessoryView { + // Both caret and link. Read all content on caret. + accessoryView.accessibilityLabel = getAccessibilityMessage() + accessibilityElements = [accessoryView, link] } else { - // Allow only radio button and link to be focused on. - var elements: [UIView] = [] - - + // Only link. Manually add accessibility elements to ensure they are read in the right order. + var elements: [Any] = [] if let eyeBrowText = eyebrow.text, !eyeBrowText.isEmpty { elements.append(eyebrow) } @@ -119,11 +124,7 @@ import Foundation if let bodyText = body.text, !bodyText.isEmpty { elements.append(body) } - - if linkShowing { - elements.append(link) - } - + elements.append(link) accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index bad9caca..cced55dd 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -24,8 +24,6 @@ import Foundation super.setupView() addMolecule(headlineBody) - isAccessibilityElement = true - updateAccessibilityLabel() } open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?){ @@ -46,7 +44,7 @@ import Foundation //----------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let headlineLabel = headlineBody.headlineLabel.text { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift index 00a09527..6e0013d1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift @@ -42,8 +42,6 @@ import Foundation super.setupView() addMolecule(stack) stack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } //-------------------------------------------------- @@ -77,7 +75,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftText = leftLabel.text, !leftText.isEmpty { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift index 20e7378a..c8aaef83 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift @@ -55,8 +55,6 @@ import Foundation arrow.pinHeightAndWidth() arrowAndLabel2Stack.restack() stack.restack() - isAccessibilityElement = true - updateAccessibilityLabel() } open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { @@ -87,7 +85,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftText = leftLabel.text, !leftText.isEmpty { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift index e0efa546..62048a71 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift @@ -54,7 +54,6 @@ import Foundation ((molecule as? StackItem)?.view as? Stack)?.restack() } containingStack.restack() - isAccessibilityElement = false } //------------------------------------------------------ diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift index 16328584..472c522d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift @@ -67,9 +67,6 @@ import Foundation leftHeadline.numberOfLines = 1 rightLabel.numberOfLines = 1 rightSubLabel.numberOfLines = 1 - - isAccessibilityElement = true - updateAccessibilityLabel() } //---------------------------------------------------- @@ -107,7 +104,7 @@ import Foundation //---------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftHeadline = leftHeadline.text, !leftHeadline.isEmpty { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift index e725bb64..cc59a15a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift @@ -31,8 +31,6 @@ import UIKit containerHelper.constrainView(view) rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) rightLabel.setContentHuggingPriority(.defaultHigh, for: .vertical) - isAccessibilityElement = true - updateAccessibilityLabel() } open override func updateView(_ size: CGFloat) { @@ -72,7 +70,7 @@ import UIKit //---------------------------------------------------- func updateAccessibilityLabel() { - + isAccessibilityElement = true var message = "" if let leftLabel = leftLabel.text, !leftLabel.isEmpty { From 023576d260ff3dc9bda2cb0eb44f151f4e01444c Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 16:32:50 -0400 Subject: [PATCH 05/14] remove unnecessary setters --- .../List/Device/ListDeviceComplexButtonMedium.swift | 1 - .../List/Device/ListDeviceComplexButtonSmall.swift | 1 - .../LeftVariable/ListLeftVariableIconAllTextLinks.swift | 1 - .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 1 - .../ListRightVariableButtonAllTextAndLinks.swift | 6 +++--- .../ListRightVariablePriceChangeAllTextAndLinks.swift | 1 - .../ListRightVariableTextLinkAllTextAndLinks.swift | 4 ++-- 7 files changed, 5 insertions(+), 10 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift index 0783ea99..5ce18f6e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift @@ -132,7 +132,6 @@ import Foundation } else { // Make whole cell focusable if no action. isAccessibilityElement = true - accessibilityElements = nil if let message = getAccessibilityMessage(), let buttonTitle = button.titleLabel?.text { accessibilityLabel = message + ", " + buttonTitle diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift index 20433a45..25ae3714 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift @@ -132,7 +132,6 @@ import Foundation } else { // Make whole cell focusable if no action. isAccessibilityElement = true - accessibilityElements = nil if let message = getAccessibilityMessage(), let buttonTitle = button.titleLabel?.text { accessibilityLabel = message + ", " + buttonTitle diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index 9e4d7533..2411a339 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -82,7 +82,6 @@ import Foundation if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() - accessibilityElements = nil } else if let accessoryView = accessoryView { // Both caret and link. Read all content on caret. accessoryView.accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index ee97a369..979f8110 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -101,7 +101,6 @@ import Foundation if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() - accessibilityElements = nil } else if let accessoryView = accessoryView { // Both caret and link. Read all content on caret. accessoryView.accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index c08d37cd..f7042b56 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -86,16 +86,16 @@ import Foundation func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 - isAccessibilityElement = !linkShowing eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing button.isAccessibilityElement = linkShowing if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action + isAccessibilityElement = true accessibilityLabel = getAccessibilityMessage() - accessibilityElements = nil } else { // Make buttons focusable. + isAccessibilityElement = false var elements: [Any] = [] if let accessoryView = accessoryView { accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() @@ -106,7 +106,7 @@ import Foundation if linkShowing { elements.append(eyebrowHeadlineBodyLink.link) } - elements.append(link) + elements.append(button) accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index 76ce1a37..4f4180a0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -107,7 +107,6 @@ import Foundation if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() - accessibilityElements = nil } else if let accessoryView = accessoryView { // Both caret and link. Read all content on caret. accessoryView.accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift index d6714f60..7a4c4595 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -83,17 +83,17 @@ import Foundation func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 - isAccessibilityElement = !linkShowing accessibilityTraits = .button eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing link.isAccessibilityElement = linkShowing if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action + isAccessibilityElement = true accessibilityLabel = getAccessibilityMessage() - accessibilityElements = nil } else { // Make buttons focusable. + isAccessibilityElement = false var elements: [Any] = [] if let accessoryView = accessoryView { accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() From 799d6555c07058872b95d585168878fc9f8c1164 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 16:34:18 -0400 Subject: [PATCH 06/14] remove duplicate code device list --- .../List/Device/ListDeviceComplexButtonSmall.swift | 1 - .../ListLeftVariableNumberedListAllTextAndLinks.swift | 1 - 2 files changed, 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift index 25ae3714..2503cf8a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift @@ -123,7 +123,6 @@ import Foundation } func updateAccessibilityLabel() { - accessibilityTraits = .button if let accessoryView = accessoryView { // Both caret and button. Read all content on caret. isAccessibilityElement = false diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index 183514de..e0819e4e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -94,7 +94,6 @@ import Foundation if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() - accessibilityElements = nil } else if let accessoryView = accessoryView { // Both caret and link. Read all content on caret. accessoryView.accessibilityLabel = getAccessibilityMessage() From 00a71036f3e3954356e43e004e49b5aa5cf7c7c9 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 16:35:28 -0400 Subject: [PATCH 07/14] remove duplicate --- .../List/Device/ListDeviceComplexButtonMedium.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift index 5ce18f6e..cca10f8f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift @@ -123,7 +123,6 @@ import Foundation } func updateAccessibilityLabel() { - accessibilityTraits = .button if let accessoryView = accessoryView { // Both caret and button. Read all content on caret. isAccessibilityElement = false From 9498053dce49f8cccdd6e7dfb65ae4c77da70bcc Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 16:52:51 -0400 Subject: [PATCH 08/14] remove unneeded code --- .../ListLeftVariableCheckboxAllTextAndLinks.swift | 6 ------ .../LeftVariable/ListLeftVariableCheckboxBodyText.swift | 1 - .../LeftVariable/ListLeftVariableIconAllTextLinks.swift | 4 +--- .../ListLeftVariableNumberedListAllTextAndLinks.swift | 1 - .../ListLeftVariableRadioButtonAllTextAndLinks.swift | 3 --- .../ListLeftVariableRadioButtonAndPaymentMethod.swift | 3 --- .../LeftVariable/ListLeftVariableRadioButtonBodyText.swift | 1 - .../ListRightVariableButtonAllTextAndLinks.swift | 3 --- .../ListRightVariableTextLinkAllTextAndLinks.swift | 3 --- 9 files changed, 1 insertion(+), 24 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift index 9c8976f6..65d1bd63 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift @@ -49,8 +49,6 @@ import Foundation addMolecule(stack) stack.restack() - isAccessibilityElement = true - checkbox.isAccessibilityElement = false accessibilityTraits = checkbox.accessibilityTraits accessibilityHint = checkbox.accessibilityHint // Update accessibility label on checkbox state change. @@ -97,11 +95,7 @@ import Foundation } let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 - isAccessibilityElement = !linkShowing - checkbox.isAccessibilityElement = linkShowing - eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = message diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift index 1d83cbfb..9d58b625 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift @@ -49,7 +49,6 @@ import Foundation addMolecule(stack) stack.restack() isAccessibilityElement = true - checkbox.isAccessibilityElement = false accessibilityTraits = checkbox.accessibilityTraits accessibilityHint = checkbox.accessibilityHint // Update accessibility label on checkbox state change. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index 2411a339..15ec2c22 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -76,9 +76,7 @@ import Foundation let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none - eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index e0819e4e..1da91ee3 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -90,7 +90,6 @@ import Foundation let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none - eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift index 229a2456..e5e9e178 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift @@ -95,9 +95,6 @@ import Foundation let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - radioButton.isAccessibilityElement = linkShowing - eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = message diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index 6cc26352..e8a2ed3c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -113,9 +113,6 @@ import UIKit let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - radioButton.isAccessibilityElement = linkShowing - eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = message diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift index 860b78f8..c6349aa1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift @@ -47,7 +47,6 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell { // Make the whole cell focusable. isAccessibilityElement = true - radioButton.isAccessibilityElement = false accessibilityTraits = radioButton.accessibilityTraits accessibilityHint = radioButton.accessibilityHint updateAccessibilityLabel() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index f7042b56..9c590b0c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -86,9 +86,6 @@ import Foundation func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 - eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - button.isAccessibilityElement = linkShowing - if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action isAccessibilityElement = true diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift index 7a4c4595..215eb9f0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -84,9 +84,6 @@ import Foundation func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 accessibilityTraits = .button - eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - link.isAccessibilityElement = linkShowing - if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action isAccessibilityElement = true From 36505156d570644c83f2ff0d9fd3ed1b7eca2376 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 17:36:13 -0400 Subject: [PATCH 09/14] image accessibility fix --- .../List/Device/ListDeviceComplexButtonMedium.swift | 2 +- .../List/Device/ListDeviceComplexButtonSmall.swift | 2 +- .../List/Device/ListDeviceComplexLinkMedium.swift | 6 +++--- .../List/Device/ListDeviceComplexLinkSmall.swift | 6 +++--- .../LeftVariable/ListLeftVariableIconAllTextLinks.swift | 4 ++-- .../ListLeftVariableIconWithRightCaretBodyText.swift | 2 +- .../ListLeftVariableRadioButtonAndPaymentMethod.swift | 2 +- .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 4 +--- .../List/RightVariable/ListRightVariablePayments.swift | 2 +- .../ListRightVariablePriceChangeAllTextAndLinks.swift | 4 +--- 10 files changed, 15 insertions(+), 19 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift index cca10f8f..d8885875 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift @@ -116,7 +116,7 @@ import Foundation message += body2Text + ", " } - if let rightImageViewText = rightImageView.accessibilityLabel, !rightImageViewText.isEmpty { + if let rightImageViewText = rightImageView.imageView.accessibilityLabel, !rightImageViewText.isEmpty { message += rightImageViewText } return message.count > 0 ? message : nil diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift index 2503cf8a..b2e4b25c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift @@ -116,7 +116,7 @@ import Foundation message += body2Text + ", " } - if let rightImageViewText = rightImageView.accessibilityLabel, !rightImageViewText.isEmpty { + if let rightImageViewText = rightImageView.imageView.accessibilityLabel, !rightImageViewText.isEmpty { message += rightImageViewText } return message.count > 0 ? message : nil diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift index 9c75f78c..ee6ade09 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift @@ -114,7 +114,7 @@ import Foundation message += body2Text + ", " } - if let rightImageLabel = rightImage.accessibilityLabel, !rightImageLabel.isEmpty { + if let rightImageLabel = rightImage.imageView.accessibilityLabel, !rightImageLabel.isEmpty { message += rightImageLabel } @@ -145,8 +145,8 @@ import Foundation views.append(twoLinkView.leftLink) views.append(twoLinkView.rightLink) - if let rightImageLabel = rightImage.accessibilityLabel, !rightImageLabel.isEmpty { - views.append(rightImage) + if let rightImageLabel = rightImage.imageView.accessibilityLabel, !rightImageLabel.isEmpty { + views.append(rightImage.imageView) } accessibilityElements = views diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmall.swift index 6a469b0d..1791ec9d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmall.swift @@ -111,7 +111,7 @@ import Foundation message += body2Text + ", " } - if let rightImageLabel = rightImage.accessibilityLabel, !rightImageLabel.isEmpty { + if let rightImageLabel = rightImage.imageView.accessibilityLabel, !rightImageLabel.isEmpty { message += rightImageLabel } @@ -142,8 +142,8 @@ import Foundation views.append(twoLinkView.leftLink) views.append(twoLinkView.rightLink) - if let rightImageLabel = rightImage.accessibilityLabel, !rightImageLabel.isEmpty { - views.append(rightImage) + if let rightImageLabel = rightImage.imageView.accessibilityLabel, !rightImageLabel.isEmpty { + views.append(rightImage.imageView) } accessibilityElements = views diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index 15ec2c22..7396aefa 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -87,8 +87,8 @@ import Foundation } else { // Only link. Manually add accessibility elements to ensure they are read in the right order. var elements: [Any] = [] - if let leftImageLabel = leftImage.accessibilityLabel, !leftImageLabel.isEmpty { - elements.append(leftImage) + if let leftImageLabel = leftImage.imageView.accessibilityLabel, !leftImageLabel.isEmpty { + elements.append(leftImage.imageView) } if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { elements.append(otherElements) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index c416e536..c69bebb2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -94,7 +94,7 @@ import Foundation isAccessibilityElement = true var message = "" - if let leftImageLabel = leftImage.accessibilityLabel { + if let leftImageLabel = leftImage.imageView.accessibilityLabel { message += leftImageLabel + ", " } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index e8a2ed3c..9d036d4f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -103,7 +103,7 @@ import UIKit message += radioButtonLabel + ", " } - if let leftImageLabel = leftImage.accessibilityLabel { + if let leftImageLabel = leftImage.imageView.accessibilityLabel { message += leftImageLabel + ", " } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 979f8110..a355dd4c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -95,9 +95,7 @@ import Foundation func updateAccessibilityLabel() { let linkShowing = link.titleLabel?.text?.count ?? 0 > 0 - isAccessibilityElement = !linkShowing - link.isAccessibilityElement = linkShowing - + isAccessibilityElement = !linkShowing if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 2b12a4c2..f6526e10 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -77,7 +77,7 @@ import Foundation message += leftLabelText + ", " } - if let rightImageText = rightImage.accessibilityLabel, !rightImageText.isEmpty { + if let rightImageText = rightImage.imageView.accessibilityLabel, !rightImageText.isEmpty { message += rightImageText } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index 4f4180a0..65301304 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -101,9 +101,7 @@ import Foundation func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none - eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing - + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() From d5447e5842cafb8b041c4b5628a365754bf2ac6a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 17:37:35 -0400 Subject: [PATCH 10/14] missed image commit --- .../List/LeftVariable/ListLeftVariableIconAllTextLinks.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index 7396aefa..9655c4dd 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -63,7 +63,7 @@ import Foundation } func getAccessibilityMessage() -> String? { - guard let leftImageLabel = leftImage.accessibilityLabel else { + guard let leftImageLabel = leftImage.imageView.accessibilityLabel else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { From 0e42a10c13dbbb74408c32ab52a9232535086231 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 17:46:14 -0400 Subject: [PATCH 11/14] image fix --- .../List/LeftVariable/ListLeftVariableIconWithRightCaret.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 821becbe..2ebe1c98 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -79,7 +79,7 @@ import UIKit isAccessibilityElement = true var message = "" - if let leftImageLabel = leftImage.accessibilityLabel { + if let leftImageLabel = leftImage.imageView.accessibilityLabel { message += leftImageLabel + ", " } From 7f7edb1ab6ba211933a564c5acd8e2e1bbf28151 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 15 Jun 2020 11:12:02 -0400 Subject: [PATCH 12/14] change ordering --- .../RightVariable/ListRightVariableButtonAllTextAndLinks.swift | 2 +- .../ListRightVariableTextLinkAllTextAndLinks.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index 9c590b0c..f0d5cdbf 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -100,10 +100,10 @@ import Foundation } else { button.accessibilityLabel = getAccessibilityMessage() } + elements.append(button) if linkShowing { elements.append(eyebrowHeadlineBodyLink.link) } - elements.append(button) accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift index 215eb9f0..2c2f25bc 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -98,10 +98,10 @@ import Foundation } else { link.accessibilityLabel = getAccessibilityMessage() } + elements.append(link) if linkShowing { elements.append(eyebrowHeadlineBodyLink.link) } - elements.append(link) accessibilityElements = elements } } From fbc631d151a9fee2cdacacedb587578e7b5cfbdb Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 15 Jun 2020 11:42:31 -0400 Subject: [PATCH 13/14] trait miss --- .../OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index a355dd4c..184abebc 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 func updateAccessibilityLabel() { let linkShowing = link.titleLabel?.text?.count ?? 0 > 0 - isAccessibilityElement = !linkShowing + isAccessibilityElement = !linkShowing + accessibilityTraits = (accessoryView != nil) ? .button : .none if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() From 8200fe07d26b195b040429e3253c2caa7b406c36 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 16 Jun 2020 11:02:31 -0400 Subject: [PATCH 14/14] swap trait and hint due to apple defect --- MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift | 2 +- MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift | 2 +- .../Views/CarouselIndicator/BarsIndicatorView.swift | 2 +- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- .../List/Device/ListDeviceComplexButtonMedium.swift | 2 +- .../List/Device/ListDeviceComplexButtonSmall.swift | 2 +- .../ListLeftVariableCheckboxAllTextAndLinks.swift | 2 +- .../LeftVariable/ListLeftVariableCheckboxBodyText.swift | 2 +- .../ListLeftVariableRadioButtonAndPaymentMethod.swift | 4 ++-- .../ListLeftVariableRadioButtonBodyText.swift | 2 +- .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 9 ++++++++- .../VerticalCombinationViews/ThreeHeadlineBodyLink.swift | 2 +- MVMCoreUI/BaseClasses/TableViewCell.swift | 2 +- 13 files changed, 22 insertions(+), 15 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift b/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift index cffbb916..f23fd337 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift @@ -157,9 +157,9 @@ import MVMCore override public init(frame: CGRect) { super.init(frame: frame) - accessibilityTraits = .button isAccessibilityElement = true accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "checkbox_action_hint") + accessibilityTraits = .button updateAccessibilityLabel() } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift index 43750513..371d3f7a 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift @@ -147,8 +147,8 @@ import UIKit addTarget(self, action: #selector(tapAction), for: .touchUpInside) isAccessibilityElement = true - accessibilityTraits = .button accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") + accessibilityTraits = .button updateAccessibilityLabel() } diff --git a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift index 9dc4a0bd..69048e74 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift @@ -115,12 +115,12 @@ open class BarsIndicatorView: CarouselIndicator { for i in 0.. (Bool) super.setupView() isAccessibilityElement = true - accessibilityTraits = .button accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccToggleHint") accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "Toggle_buttonlabel") - + accessibilityTraits = .button + heightConstraint = heightAnchor.constraint(equalToConstant: Self.containerSize.height) heightConstraint?.isActive = true diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift index d8885875..986ee73b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift @@ -58,8 +58,8 @@ import Foundation addMolecule(stack) stack.restack() verticalStack.restack() - accessibilityTraits = button.accessibilityTraits accessibilityHint = button.accessibilityHint + accessibilityTraits = button.accessibilityTraits } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift index b2e4b25c..cd43215b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift @@ -58,8 +58,8 @@ import Foundation addMolecule(stack) stack.restack() verticalStack.restack() - accessibilityTraits = button.accessibilityTraits accessibilityHint = button.accessibilityHint + accessibilityTraits = button.accessibilityTraits } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift index 65d1bd63..ff625e8b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift @@ -49,8 +49,8 @@ import Foundation addMolecule(stack) stack.restack() - accessibilityTraits = checkbox.accessibilityTraits accessibilityHint = checkbox.accessibilityHint + accessibilityTraits = checkbox.accessibilityTraits // Update accessibility label on checkbox state change. observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift index 9d58b625..69ad2156 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift @@ -49,8 +49,8 @@ import Foundation addMolecule(stack) stack.restack() isAccessibilityElement = true - accessibilityTraits = checkbox.accessibilityTraits accessibilityHint = checkbox.accessibilityHint + accessibilityTraits = checkbox.accessibilityTraits // Update accessibility label on checkbox state change. observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index 9d036d4f..e14e91e2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -50,9 +50,9 @@ import UIKit eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA eyebrowHeadlineBodyLink.headline.setFontStyle(.BoldBodySmall) - accessibilityTraits = radioButton.accessibilityTraits accessibilityHint = radioButton.accessibilityHint - + accessibilityTraits = radioButton.accessibilityTraits + // Update accessibility label on radio button state change. observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift index c6349aa1..a30f3f9e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift @@ -47,8 +47,8 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell { // Make the whole cell focusable. isAccessibilityElement = true - accessibilityTraits = radioButton.accessibilityTraits accessibilityHint = radioButton.accessibilityHint + accessibilityTraits = radioButton.accessibilityTraits updateAccessibilityLabel() // Update accessibility label on radio button state change. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 184abebc..6e5a7245 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -92,11 +92,18 @@ import Foundation return message.count > 0 ? message : nil } + // Ensures voice over does not read "selected" after user triggers action on cell. + override public var accessibilityTraits: UIAccessibilityTraits { + get { + return (accessoryView != nil) ? .button : .none + } + set {} + } + func updateAccessibilityLabel() { let linkShowing = link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (accessoryView != nil) ? .button : .none if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/ThreeHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/ThreeHeadlineBodyLink.swift index 474907dd..5926951f 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/ThreeHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/ThreeHeadlineBodyLink.swift @@ -73,8 +73,8 @@ open class ThreeHeadlineBodyLink: View { bottomAnchor.constraint(equalTo: link.bottomAnchor).isActive = true isAccessibilityElement = true - accessibilityTraits = link.accessibilityTraits accessibilityHint = link.accessibilityHint + accessibilityTraits = link.accessibilityTraits updateAccessibilityLabel() } diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index caaeec85..300150e8 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -205,8 +205,8 @@ import UIKit let caret = CaretView(lineWidth: 1) caret.translatesAutoresizingMaskIntoConstraints = true caret.isAccessibilityElement = true - caret.accessibilityTraits = .button caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint") + caret.accessibilityTraits = .button caret.size = .small(.vertical) if let size = caret.size?.dimensions() { caret.frame = CGRect(origin: CGPoint.zero, size: size)