mirror of
https://github.com/signalapp/Signal-iOS.git
synced 2025-12-05 01:10:41 +00:00
VoiceOver improvements in Registration flow.
This commit is contained in:
committed by
GitHub
parent
0f66c10ddc
commit
ec1e164c37
@@ -33,9 +33,13 @@ struct RegistrationPermissionsView: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
VStack(spacing: headerSpacing) {
|
||||
Text(OWSLocalizedString("ONBOARDING_PERMISSIONS_TITLE", comment: "Title of the 'onboarding permissions' view."))
|
||||
Text(OWSLocalizedString(
|
||||
"ONBOARDING_PERMISSIONS_TITLE",
|
||||
comment: "Title of the 'onboarding permissions' view."
|
||||
))
|
||||
.font(.title.weight(.semibold))
|
||||
.lineLimit(1)
|
||||
.accessibilityAddTraits(.isHeader)
|
||||
Text(OWSLocalizedString("ONBOARDING_PERMISSIONS_PREAMBLE", comment: "Preamble of the 'onboarding permissions' view."))
|
||||
.dynamicTypeSize(...DynamicTypeSize.accessibility1)
|
||||
}
|
||||
@@ -155,6 +159,7 @@ private extension RegistrationPermissionsView {
|
||||
HStack(spacing: 16) {
|
||||
icon
|
||||
.frame(width: 36)
|
||||
.accessibilityHidden(true)
|
||||
title
|
||||
.font(.headline)
|
||||
.lineLimit(1)
|
||||
@@ -164,9 +169,11 @@ private extension RegistrationPermissionsView {
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.accessibilityElement(children: .combine)
|
||||
} else {
|
||||
HStack(alignment: .top, spacing: 16) {
|
||||
icon
|
||||
.accessibilityHidden(true)
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
title
|
||||
.font(.headline)
|
||||
@@ -177,6 +184,7 @@ private extension RegistrationPermissionsView {
|
||||
.layoutPriority(1)
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: .combine)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +184,19 @@ private extension RegistrationPhoneNumberDiscoverabilityViewController {
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
// MARK: Accessibility
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get { phoneNumberDiscoverability.nameForDiscoverability }
|
||||
set { super.accessibilityLabel = newValue }
|
||||
}
|
||||
|
||||
override var accessibilityHint: String? {
|
||||
get { phoneNumberDiscoverability.descriptionForDiscoverability }
|
||||
set { super.accessibilityHint = newValue }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private struct PrivacySettingButtonContentConfiguration: UIContentConfiguration {
|
||||
|
||||
@@ -133,12 +133,20 @@ class RegistrationPhoneNumberInputView: UIView {
|
||||
chevronIcon.centerYAnchor.constraint(equalTo: container.centerYAnchor),
|
||||
chevronIcon.trailingAnchor.constraint(equalTo: container.trailingAnchor),
|
||||
])
|
||||
container.accessibilityIdentifier = "registration.phonenumber.countryCode"
|
||||
container.isUserInteractionEnabled = true
|
||||
container.addGestureRecognizer(UITapGestureRecognizer(
|
||||
target: self,
|
||||
action: #selector(didTapCountryCode)
|
||||
))
|
||||
|
||||
container.isAccessibilityElement = true
|
||||
container.accessibilityTraits = .button
|
||||
container.accessibilityIdentifier = "registration.phonenumber.countryCode"
|
||||
container.accessibilityLabel = OWSLocalizedString(
|
||||
"REGISTRATION_DEFAULT_COUNTRY_NAME",
|
||||
comment: "Label for the country code field"
|
||||
)
|
||||
|
||||
return container
|
||||
}()
|
||||
|
||||
@@ -160,6 +168,7 @@ class RegistrationPhoneNumberInputView: UIView {
|
||||
|
||||
private func update() {
|
||||
countryCodeLabel.text = country.plusPrefixedCallingCode
|
||||
countryCodeView.accessibilityValue = countryCodeLabel.text
|
||||
nationalNumberView.isEnabled = isEnabled
|
||||
}
|
||||
|
||||
|
||||
@@ -491,6 +491,28 @@ extension RegistrationProfileViewController {
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
// MARK: Accessibility
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get {
|
||||
OWSLocalizedString(
|
||||
"REGISTRATION_PROFILE_SETUP_FIND_MY_NUMBER_TITLE",
|
||||
comment: "During registration, users can choose who can see their phone number."
|
||||
)
|
||||
}
|
||||
set { super.accessibilityLabel = newValue }
|
||||
}
|
||||
|
||||
override var accessibilityValue: String? {
|
||||
get { phoneNumberDiscoverability.nameForDiscoverability }
|
||||
set { super.accessibilityValue = newValue }
|
||||
}
|
||||
|
||||
override var accessibilityHint: String? {
|
||||
get { phoneNumberDiscoverability.descriptionForDiscoverability }
|
||||
set { super.accessibilityHint = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
private struct PhoneNumberPrivacyButtonContentConfiguration: UIContentConfiguration {
|
||||
|
||||
@@ -44,6 +44,7 @@ extension UILabel {
|
||||
result.numberOfLines = 0
|
||||
result.lineBreakMode = .byWordWrapping
|
||||
result.textAlignment = .center
|
||||
result.accessibilityTraits = [ .staticText, .header ]
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -94,6 +95,9 @@ extension UIButton {
|
||||
contentView.bottomAnchor.constraint(equalTo: button.bottomAnchor)
|
||||
])
|
||||
|
||||
button.accessibilityLabel = contentConfiguration.title
|
||||
button.accessibilityHint = contentConfiguration.subtitle
|
||||
|
||||
return button as! Self
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user