From 8de78987f88a851cea33a75500841496e0d9df3a Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Fri, 1 Dec 2023 14:32:44 +0530 Subject: [PATCH 1/4] Setting accessibility label if available before text for eyebrow, headline, body labels in EyebrowHeadlineBodyLink molecule's accessibility label --- .../VerticalCombinationViews/EyebrowHeadlineBodyLink.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index a25426d7..da5e959e 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -88,15 +88,15 @@ var message = "" - if let eyebrowLabel = eyebrow.text { + if let eyebrowLabel = eyebrow.accessibilityLabel ?? eyebrow.text { message += eyebrowLabel + ", " } - if let headlineLabel = headline.text { + if let headlineLabel = headline.accessibilityLabel ?? headline.text { message += headlineLabel + ", " } - if let bodyLabel = body.text { + if let bodyLabel = body.accessibilityLabel ?? body.text { message += bodyLabel } From 6e5980af64c51c1e0998b06d5d8e1b2b56c1b9c9 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Fri, 1 Dec 2023 14:12:04 -0500 Subject: [PATCH 2/4] Index check before switching tabs. --- .../HorizontalCombinationViews/TabBar.swift | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index 605acc3d..01e71db8 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -84,16 +84,22 @@ import VDSColorTokens // MARK: - TabBarProtocol @MainActor public func highlightTab(at index: Int) { - guard let newSelectedItem = items?[index] else { return } + guard let items = items, index < items.count else { + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available (\(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + return + } tabModel.selectedTab = index - selectedItem = newSelectedItem + selectedItem = items[index] } @MainActor public func selectTab(at index: Int) { - guard let newSelectedItem = items?[index] else { return } - selectedItem = newSelectedItem - tabBar(self, didSelect: newSelectedItem) + guard let items = items, index < items.count else { + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available (\(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + return + } + selectedItem = items[index] + tabBar(self, didSelect: items[index]) } public func currentTabIndex() -> Int { tabModel.selectedTab } From 21f24b2c9b339e8d5232383caedbd0ffc67694b9 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Fri, 1 Dec 2023 14:16:00 -0500 Subject: [PATCH 3/4] remove extra paranthesis --- .../Atomic/Molecules/HorizontalCombinationViews/TabBar.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index 01e71db8..d0252419 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -85,7 +85,7 @@ import VDSColorTokens @MainActor public func highlightTab(at index: Int) { guard let items = items, index < items.count else { - MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available (\(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) return } tabModel.selectedTab = index @@ -95,7 +95,7 @@ import VDSColorTokens @MainActor public func selectTab(at index: Int) { guard let items = items, index < items.count else { - MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available (\(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) return } selectedItem = items[index] From 8b64b2b52a458fb7ed7d23bb0de24e353dbb85a9 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Fri, 1 Dec 2023 14:32:33 -0500 Subject: [PATCH 4/4] Ensure index > 0 for those tricky ones. --- .../Molecules/HorizontalCombinationViews/TabBar.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index d0252419..65b116f5 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -84,8 +84,8 @@ import VDSColorTokens // MARK: - TabBarProtocol @MainActor public func highlightTab(at index: Int) { - guard let items = items, index < items.count else { - MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + guard let items = items, index >= 0, index < items.count else { + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Invalid tab index \(index). \(items?.count ?? 0) tabs available .", code: 0, domain: ErrorDomainSystem, location: #function)!) return } tabModel.selectedTab = index @@ -94,8 +94,8 @@ import VDSColorTokens @MainActor public func selectTab(at index: Int) { - guard let items = items, index < items.count else { - MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + guard let items = items, index >= 0, index < items.count else { + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Invalid tab index \(index). \(items?.count ?? 0) tabs available.", code: 0, domain: ErrorDomainSystem, location: #function)!) return } selectedItem = items[index]