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