From 36505156d570644c83f2ff0d9fd3ed1b7eca2376 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Jun 2020 17:36:13 -0400 Subject: [PATCH] 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()