Skip to content

Commit

Permalink
feat: Add accessibility support to the AuthenticationIdentityInputVie…
Browse files Browse the repository at this point in the history
…w - WPB-15221 (#2435)

Co-authored-by: El-Fitz <[email protected]>
  • Loading branch information
KaterinaWire and El-Fitz authored Jan 28, 2025
1 parent 0b9b184 commit 237f40d
Show file tree
Hide file tree
Showing 31 changed files with 76 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@
"authentication.identity.input.field.placeholder" = "Email or SSO code";
"authentication.identity.input.field.title" = "Email or SSO code";
"authentication.identity.input.submit" = "Next";
"authentication.identity.input.terms" = "By pressing on “Next”, you accept Wire’s [Terms and Conditions](%@)";

Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ package struct AuthenticationIdentityInputView: View {

@State private var identity: String = ""
private let actionCallback: @Sendable (Action) -> Void
private let termsURL: URL

package init(actionCallback: @escaping @Sendable (Action) -> Void, termsURL: URL) {
package init(actionCallback: @escaping @Sendable (Action) -> Void) {
self.actionCallback = actionCallback
self.termsURL = termsURL
}

package var body: some View {
Expand All @@ -47,15 +45,19 @@ package struct AuthenticationIdentityInputView: View {
.frame(maxWidth: .infinity)
}
Text(L10n.Authentication.Identity.Input.body)
.multilineTextAlignment(.leading)
.wireTextStyle(.body1)
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
.padding(.trailing)
LabeledTextField(
isMandatory: false,
placeholder: L10n.Authentication.Identity.Input.Field.placeholder,
title: L10n.Authentication.Identity.Input.Field.title,
string: $identity
)
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
Button(action: {
actionCallback(.submit(identity: identity))
}, label: {
Expand All @@ -64,19 +66,14 @@ package struct AuthenticationIdentityInputView: View {
})
.wireButtonStyle(.primary)
.disabled(identity.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
Text(AttributedString.markdown(from: L10n.Authentication.Identity.Input.terms(termsURL.absoluteString)))
.multilineTextAlignment(.center)
.wireTextStyle(.subline1)
.lineLimit(nil)
}
}
}

struct AuthenticationIdentityInputPreview: View {
var body: some View {
AuthenticationIdentityInputView(
actionCallback: { _ in },
termsURL: URL(string: "https://example.com")!
actionCallback: { _ in }
)
.environment(\.wireTextStyleMapping, WireTextStyleMapping())
.padding(32)
Expand Down Expand Up @@ -104,3 +101,16 @@ struct AuthenticationIdentityInputPreview: View {
}
}
}

#Preview("Large font") {
BackgroundView()
.overlay {
VStack(spacing: 0) {
Spacer()
.frame(maxHeight: .infinity)
AuthenticationIdentityInputPreview()
.background()
}
}
.environment(\.sizeCategory, .accessibilityExtraExtraExtraLarge)
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public struct LabeledTextField: View {
) : Text(title)
)
.foregroundStyle(titleColor)
.wireTextStyle(.subline1)
.wireTextStyle(.h4)
}
HStack(spacing: 0) {
TextField(placeholder ?? "", text: $string)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 237f40d

Please sign in to comment.