summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2021-07-09 17:57:12 +0200
committerAndrej Mihajlov <and@mullvad.net>2021-07-16 13:43:36 +0200
commit3d31a48cae5f02495f85bfa94dfaf435d4318609 (patch)
tree3bfc181f030f577b84453e147c9db7e48a544900 /ios
parent2b9f674affac160d615c1f1270d8fa880f562ddb (diff)
downloadmullvadvpn-3d31a48cae5f02495f85bfa94dfaf435d4318609.tar.xz
mullvadvpn-3d31a48cae5f02495f85bfa94dfaf435d4318609.zip
Accessibility: handle placeholder and accessibility path in CustomTextView
Diffstat (limited to 'ios')
-rw-r--r--ios/MullvadVPN/CustomTextView.swift28
1 files changed, 28 insertions, 0 deletions
diff --git a/ios/MullvadVPN/CustomTextView.swift b/ios/MullvadVPN/CustomTextView.swift
index afa7c65fc5..20eed2f786 100644
--- a/ios/MullvadVPN/CustomTextView.swift
+++ b/ios/MullvadVPN/CustomTextView.swift
@@ -57,9 +57,37 @@ class CustomTextView: UITextView {
return placeholderInset
}
+ override var accessibilityLabel: String? {
+ set {
+ super.accessibilityLabel = newValue
+ }
+ get {
+ if self.text.isEmpty {
+ return placeholderTextLabel.text
+ } else {
+ return super.accessibilityLabel
+ }
+ }
+ }
+
+ override var accessibilityPath: UIBezierPath? {
+ set {
+ super.accessibilityPath = newValue
+ }
+ get {
+ if roundCorners {
+ return UIBezierPath(roundedRect: accessibilityFrame, cornerRadius: kTextViewCornerRadius)
+ } else {
+ return UIBezierPath(rect: accessibilityFrame)
+ }
+ }
+ }
+
override init(frame: CGRect, textContainer: NSTextContainer?) {
super.init(frame: frame, textContainer: textContainer)
+ placeholderTextLabel.isAccessibilityElement = false
+ placeholderTextLabel.accessibilityTraits = []
placeholderTextLabel.textColor = UIColor.TextField.placeholderTextColor
placeholderTextLabel.highlightedTextColor = UIColor.TextField.placeholderTextColor
placeholderTextLabel.translatesAutoresizingMaskIntoConstraints = false