added accessibleText for actions as an override
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
be71919ccf
commit
7551519d2d
@ -161,7 +161,7 @@ open class LabelBase<ModelType: LabelModel>: UILabel, ModelHandlerable, ViewProt
|
|||||||
//see if the attribute is Actionable
|
//see if the attribute is Actionable
|
||||||
if let actionable = attribute as? any LabelAttributeActionable{
|
if let actionable = attribute as? any LabelAttributeActionable{
|
||||||
//create a accessibleAction
|
//create a accessibleAction
|
||||||
let customAccessibilityAction = customAccessibilityAction(range: actionable.range)
|
let customAccessibilityAction = customAccessibilityAction(range: actionable.range, accessibleText: actionable.accessibleText)
|
||||||
|
|
||||||
//create a wrapper for the attributes range, block and
|
//create a wrapper for the attributes range, block and
|
||||||
actions.append(LabelAction(range: actionable.range, action: actionable.action, accessibilityID: customAccessibilityAction?.hashValue ?? -1))
|
actions.append(LabelAction(range: actionable.range, action: actionable.action, accessibilityID: customAccessibilityAction?.hashValue ?? -1))
|
||||||
@ -274,7 +274,7 @@ open class LabelBase<ModelType: LabelModel>: UILabel, ModelHandlerable, ViewProt
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Accessibility For Actions
|
// MARK: - Accessibility For Actions
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private func customAccessibilityAction(range: NSRange) -> UIAccessibilityCustomAction? {
|
private func customAccessibilityAction(range: NSRange, accessibleText: String? = nil) -> UIAccessibilityCustomAction? {
|
||||||
|
|
||||||
guard let text = text else { return nil }
|
guard let text = text else { return nil }
|
||||||
//TODO: accessibilityHint for Label
|
//TODO: accessibilityHint for Label
|
||||||
@ -282,7 +282,7 @@ open class LabelBase<ModelType: LabelModel>: UILabel, ModelHandlerable, ViewProt
|
|||||||
// accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "swipe_to_select_with_action_hint")
|
// accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "swipe_to_select_with_action_hint")
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let actionText = NSString(string: text).substring(with: range)
|
let actionText = accessibleText ?? NSString(string:text).substring(with: range)
|
||||||
let accessibleAction = UIAccessibilityCustomAction(name: actionText, target: self, selector: #selector(accessibilityCustomAction(_:)))
|
let accessibleAction = UIAccessibilityCustomAction(name: actionText, target: self, selector: #selector(accessibilityCustomAction(_:)))
|
||||||
accessibilityCustomActions?.append(accessibleAction)
|
accessibilityCustomActions?.append(accessibleAction)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user