diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 93eb5754..8dae7755 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -161,7 +161,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //see if the attribute is Actionable if let actionable = attribute as? any LabelAttributeActionable{ //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 actions.append(LabelAction(range: actionable.range, action: actionable.action, accessibilityID: customAccessibilityAction?.hashValue ?? -1)) @@ -274,7 +274,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //-------------------------------------------------- // 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 } //TODO: accessibilityHint for Label @@ -282,7 +282,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt // 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(_:))) accessibilityCustomActions?.append(accessibleAction)