updated trait from text to link when there is a action

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-01 09:21:16 -05:00
parent d275c476b3
commit 05543e7c89

View File

@ -223,6 +223,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
private var actions: [LabelAction] = [] {
didSet {
isUserInteractionEnabled = !actions.isEmpty
accessibilityTraits = !actions.isEmpty ? .link : .staticText
if actions.isEmpty {
tapGesture = nil
} else {
@ -265,7 +266,6 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
let actionText = accessibleText ?? NSString(string:text).substring(with: range)
let accessibleAction = UIAccessibilityCustomAction(name: actionText, target: self, selector: #selector(accessibilityCustomAction(_:)))
accessibilityCustomActions?.append(accessibleAction)
return accessibleAction
}
@ -295,4 +295,3 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
return false
}
}