Skip to content

Commit f19d486

Browse files
igor-signalsashaweiss-signal
authored andcommitted
VoiceOver improvements in Registration flow.
1 parent a0182c4 commit f19d486

File tree

5 files changed

+58
-2
lines changed

5 files changed

+58
-2
lines changed

Signal/Registration/UserInterface/RegistrationPermissionsView.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ struct RegistrationPermissionsView: View {
3333
var body: some View {
3434
VStack {
3535
VStack(spacing: headerSpacing) {
36-
Text(OWSLocalizedString("ONBOARDING_PERMISSIONS_TITLE", comment: "Title of the 'onboarding permissions' view."))
36+
Text(OWSLocalizedString(
37+
"ONBOARDING_PERMISSIONS_TITLE",
38+
comment: "Title of the 'onboarding permissions' view."
39+
))
3740
.font(.title.weight(.semibold))
3841
.lineLimit(1)
42+
.accessibilityAddTraits(.isHeader)
3943
Text(OWSLocalizedString("ONBOARDING_PERMISSIONS_PREAMBLE", comment: "Preamble of the 'onboarding permissions' view."))
4044
.dynamicTypeSize(...DynamicTypeSize.accessibility1)
4145
}
@@ -155,6 +159,7 @@ private extension RegistrationPermissionsView {
155159
HStack(spacing: 16) {
156160
icon
157161
.frame(width: 36)
162+
.accessibilityHidden(true)
158163
title
159164
.font(.headline)
160165
.lineLimit(1)
@@ -164,9 +169,11 @@ private extension RegistrationPermissionsView {
164169
.font(.subheadline)
165170
.foregroundStyle(.secondary)
166171
}
172+
.accessibilityElement(children: .combine)
167173
} else {
168174
HStack(alignment: .top, spacing: 16) {
169175
icon
176+
.accessibilityHidden(true)
170177
VStack(alignment: .leading, spacing: 4) {
171178
title
172179
.font(.headline)
@@ -177,6 +184,7 @@ private extension RegistrationPermissionsView {
177184
.layoutPriority(1)
178185
}
179186
}
187+
.accessibilityElement(children: .combine)
180188
}
181189
}
182190
}

Signal/Registration/UserInterface/RegistrationPhoneNumberDiscoverabilityViewController.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,19 @@ private extension RegistrationPhoneNumberDiscoverabilityViewController {
184184
required init?(coder: NSCoder) {
185185
fatalError("init(coder:) has not been implemented")
186186
}
187+
188+
// MARK: Accessibility
189+
190+
override var accessibilityLabel: String? {
191+
get { phoneNumberDiscoverability.nameForDiscoverability }
192+
set { super.accessibilityLabel = newValue }
193+
}
194+
195+
override var accessibilityHint: String? {
196+
get { phoneNumberDiscoverability.descriptionForDiscoverability }
197+
set { super.accessibilityHint = newValue }
198+
}
199+
187200
}
188201

189202
private struct PrivacySettingButtonContentConfiguration: UIContentConfiguration {

Signal/Registration/UserInterface/RegistrationPhoneNumberInputView.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,20 @@ class RegistrationPhoneNumberInputView: UIView {
133133
chevronIcon.centerYAnchor.constraint(equalTo: container.centerYAnchor),
134134
chevronIcon.trailingAnchor.constraint(equalTo: container.trailingAnchor),
135135
])
136-
container.accessibilityIdentifier = "registration.phonenumber.countryCode"
137136
container.isUserInteractionEnabled = true
138137
container.addGestureRecognizer(UITapGestureRecognizer(
139138
target: self,
140139
action: #selector(didTapCountryCode)
141140
))
141+
142+
container.isAccessibilityElement = true
143+
container.accessibilityTraits = .button
144+
container.accessibilityIdentifier = "registration.phonenumber.countryCode"
145+
container.accessibilityLabel = OWSLocalizedString(
146+
"REGISTRATION_DEFAULT_COUNTRY_NAME",
147+
comment: "Label for the country code field"
148+
)
149+
142150
return container
143151
}()
144152

@@ -160,6 +168,7 @@ class RegistrationPhoneNumberInputView: UIView {
160168

161169
private func update() {
162170
countryCodeLabel.text = country.plusPrefixedCallingCode
171+
countryCodeView.accessibilityValue = countryCodeLabel.text
163172
nationalNumberView.isEnabled = isEnabled
164173
}
165174

Signal/Registration/UserInterface/RegistrationProfileViewController.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,28 @@ extension RegistrationProfileViewController {
491491
required init?(coder: NSCoder) {
492492
fatalError("init(coder:) has not been implemented")
493493
}
494+
495+
// MARK: Accessibility
496+
497+
override var accessibilityLabel: String? {
498+
get {
499+
OWSLocalizedString(
500+
"REGISTRATION_PROFILE_SETUP_FIND_MY_NUMBER_TITLE",
501+
comment: "During registration, users can choose who can see their phone number."
502+
)
503+
}
504+
set { super.accessibilityLabel = newValue }
505+
}
506+
507+
override var accessibilityValue: String? {
508+
get { phoneNumberDiscoverability.nameForDiscoverability }
509+
set { super.accessibilityValue = newValue }
510+
}
511+
512+
override var accessibilityHint: String? {
513+
get { phoneNumberDiscoverability.descriptionForDiscoverability }
514+
set { super.accessibilityHint = newValue }
515+
}
494516
}
495517

496518
private struct PhoneNumberPrivacyButtonContentConfiguration: UIContentConfiguration {

Signal/Registration/UserInterface/RegistrationViewUtil.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ extension UILabel {
4444
result.numberOfLines = 0
4545
result.lineBreakMode = .byWordWrapping
4646
result.textAlignment = .center
47+
result.accessibilityTraits = [ .staticText, .header ]
4748
return result
4849
}
4950

@@ -94,6 +95,9 @@ extension UIButton {
9495
contentView.bottomAnchor.constraint(equalTo: button.bottomAnchor)
9596
])
9697

98+
button.accessibilityLabel = contentConfiguration.title
99+
button.accessibilityHint = contentConfiguration.subtitle
100+
97101
return button as! Self
98102
}
99103
}

0 commit comments

Comments
 (0)