added in accessibility to icons
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
90e88f37da
commit
bf731a8a84
@ -205,15 +205,10 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
}
|
||||
|
||||
/// Descriptive Icon positioned in the contentView.
|
||||
open var descriptiveIcon = Icon().with {
|
||||
$0.isAccessibilityElement = false
|
||||
}
|
||||
open var descriptiveIcon = Icon()
|
||||
|
||||
/// Directional Icon positioned in the contentView.
|
||||
open var directionalIcon = Icon().with {
|
||||
$0.isAccessibilityElement = false
|
||||
$0.name = .rightArrow
|
||||
}
|
||||
open var directionalIcon = Icon()
|
||||
|
||||
private var _textWidth: TextWidth?
|
||||
|
||||
@ -304,7 +299,7 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
super.setup()
|
||||
color = .black
|
||||
aspectRatio = .none
|
||||
|
||||
|
||||
addContentView(stackView)
|
||||
|
||||
//badge
|
||||
@ -382,6 +377,16 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
titleLockupSubTitleLabelHeightGreaterThanConstraint = titleLockup.subTitleLabel.heightGreaterThanEqualTo(constant: titleLockup.subTitleLabel.minimumLineHeight)
|
||||
titleLockupSubTitleLabelHeightGreaterThanConstraint?.priority = .defaultHigh
|
||||
titleLockupSubTitleLabelHeightGreaterThanConstraint?.activate()
|
||||
|
||||
directionalIcon.bridge_accessibilityLabelBlock = { [weak self] in
|
||||
guard let self, let directionalIconModel else { return nil }
|
||||
return directionalIconModel.accessibleText
|
||||
}
|
||||
|
||||
descriptiveIcon.bridge_accessibilityLabelBlock = { [weak self] in
|
||||
guard let self, let descriptiveIconModel else { return nil }
|
||||
return descriptiveIconModel.accessibleText
|
||||
}
|
||||
}
|
||||
|
||||
/// Resets to default settings.
|
||||
@ -425,6 +430,14 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
let titleLockupViews = gatherAccessibilityElements(from: titleLockup)
|
||||
views.append(contentsOf: titleLockupViews)
|
||||
}
|
||||
|
||||
if descriptiveIconModel != nil {
|
||||
views.append(descriptiveIcon)
|
||||
|
||||
} else if directionalIconModel != nil {
|
||||
views.append(directionalIcon)
|
||||
}
|
||||
|
||||
containerView.setAccessibilityLabel(for: views)
|
||||
|
||||
// get the views to return
|
||||
|
||||
@ -66,6 +66,10 @@ extension Tilelet {
|
||||
public var iconName: Icon.Name {
|
||||
return self == .rightArrow ? .rightArrow : .externalLink
|
||||
}
|
||||
|
||||
public var accessibilityLabel: String {
|
||||
self == .rightArrow ? "Right Arrow" : "External Link"
|
||||
}
|
||||
}
|
||||
|
||||
public enum IconSize: String, EnumSubset {
|
||||
@ -80,7 +84,7 @@ extension Tilelet {
|
||||
public var iconColor: IconColor?
|
||||
|
||||
/// Accessible Text for the Icon
|
||||
public var accessibleText: String
|
||||
public var accessibleText: String?
|
||||
|
||||
/// Enum for a icon type you want shown..
|
||||
public var iconType: IconType
|
||||
@ -95,7 +99,7 @@ extension Tilelet {
|
||||
|
||||
self.iconType = iconType
|
||||
self.iconColor = iconColor
|
||||
self.accessibleText = accessibleText ?? iconType.iconName.rawValue
|
||||
self.accessibleText = accessibleText ?? iconType.accessibilityLabel
|
||||
self.size = size
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user