From 40dbc51b75e360a62dd060dda5827eab70f3528b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 5 Apr 2024 15:00:08 -0500 Subject: [PATCH] ONEAPP-6360 - Notification - Accessiblity issues Signed-off-by: Matt Bruce --- .../Notification/Notification.swift | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/VDS/Components/Notification/Notification.swift b/VDS/Components/Notification/Notification.swift index 7dd36b4c..7ed25962 100644 --- a/VDS/Components/Notification/Notification.swift +++ b/VDS/Components/Notification/Notification.swift @@ -39,18 +39,32 @@ open class Notification: View { public enum Style: String, CaseIterable { case info, success, warning, error - func iconName() -> Icon.Name { + var iconName: Icon.Name { switch self { case .info: - return .infoBold + .infoBold case .success: - return .checkmarkAltBold + .checkmarkAltBold case .warning: - return .warningBold + .warningBold case .error: - return .errorBold + .errorBold } } + + var accessibilityText: String { + switch self { + case .info: + "Information Message" + case .success: + "Success Message" + case .warning: + "Warning Message" + case .error: + "Catastrophic Warning Alert" + } + } + } //-------------------------------------------------- @@ -309,8 +323,9 @@ open class Notification: View { //-------------------------------------------------- private func updateIcons() { let iconColor = surface == .dark ? VDSColor.paletteWhite : VDSColor.paletteBlack - typeIcon.name = style.iconName() + typeIcon.name = style.iconName typeIcon.color = iconColor + typeIcon.accessibilityLabel = style.accessibilityText closeButton.color = iconColor closeButton.isHidden = hideCloseButton }