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:
parent
d275c476b3
commit
05543e7c89
@ -223,6 +223,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
private var actions: [LabelAction] = [] {
|
private var actions: [LabelAction] = [] {
|
||||||
didSet {
|
didSet {
|
||||||
isUserInteractionEnabled = !actions.isEmpty
|
isUserInteractionEnabled = !actions.isEmpty
|
||||||
|
accessibilityTraits = !actions.isEmpty ? .link : .staticText
|
||||||
if actions.isEmpty {
|
if actions.isEmpty {
|
||||||
tapGesture = nil
|
tapGesture = nil
|
||||||
} else {
|
} else {
|
||||||
@ -265,7 +266,6 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
let actionText = accessibleText ?? 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)
|
||||||
|
|
||||||
return accessibleAction
|
return accessibleAction
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,4 +295,3 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user