ONEAPP-6360 - Notification - Accessiblity issues

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-04-05 15:00:08 -05:00
parent 0f7d50eca4
commit 40dbc51b75

View File

@ -39,18 +39,32 @@ open class Notification: View {
public enum Style: String, CaseIterable { public enum Style: String, CaseIterable {
case info, success, warning, error case info, success, warning, error
func iconName() -> Icon.Name { var iconName: Icon.Name {
switch self { switch self {
case .info: case .info:
return .infoBold .infoBold
case .success: case .success:
return .checkmarkAltBold .checkmarkAltBold
case .warning: case .warning:
return .warningBold .warningBold
case .error: 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() { private func updateIcons() {
let iconColor = surface == .dark ? VDSColor.paletteWhite : VDSColor.paletteBlack let iconColor = surface == .dark ? VDSColor.paletteWhite : VDSColor.paletteBlack
typeIcon.name = style.iconName() typeIcon.name = style.iconName
typeIcon.color = iconColor typeIcon.color = iconColor
typeIcon.accessibilityLabel = style.accessibilityText
closeButton.color = iconColor closeButton.color = iconColor
closeButton.isHidden = hideCloseButton closeButton.isHidden = hideCloseButton
} }