mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Revert "Associate the room address field helper text and error with the field"
This reverts commit d4e7cbfdbe.
This commit is contained in:
@@ -12,23 +12,12 @@ import SwiftUI
|
||||
struct EditRoomAddressListRow: View {
|
||||
@Binding var aliasLocalPart: String
|
||||
var serverName: String
|
||||
/// The error to display, if any. Also associated with the field for VoiceOver.
|
||||
var errorDescription: String?
|
||||
/// The section's helper text, associated with the field for VoiceOver.
|
||||
var footerText: String?
|
||||
var shouldDisplayError: Bool
|
||||
|
||||
private var fullAddress: String {
|
||||
"#\(aliasLocalPart):\(serverName)"
|
||||
}
|
||||
|
||||
/// Associates the helper text and any error with the field, as they're otherwise
|
||||
/// only shown in a separate section footer.
|
||||
private var accessibilityHint: String {
|
||||
[L10n.a11yEditRoomAddressHint(fullAddress), footerText, errorDescription]
|
||||
.compactMap { $0 }
|
||||
.joined(separator: "\n")
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ListRow(kind: .custom {
|
||||
HStack(spacing: 0) {
|
||||
@@ -45,7 +34,7 @@ struct EditRoomAddressListRow: View {
|
||||
.foregroundStyle(.compound.textPrimary)
|
||||
.padding(.horizontal, 8)
|
||||
.accessibilityLabel(L10n.a11yAddress)
|
||||
.accessibilityHint(accessibilityHint)
|
||||
.accessibilityHint(L10n.a11yEditRoomAddressHint(fullAddress))
|
||||
Text(":\(serverName)")
|
||||
.font(.compound.bodyLG)
|
||||
.foregroundStyle(.compound.textSecondary)
|
||||
@@ -53,7 +42,7 @@ struct EditRoomAddressListRow: View {
|
||||
}
|
||||
.padding(ListRowPadding.textFieldInsets)
|
||||
.environment(\.layoutDirection, .leftToRight)
|
||||
.errorBackground(errorDescription != nil)
|
||||
.errorBackground(shouldDisplayError)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,8 +193,7 @@ struct CreateRoomScreen: View {
|
||||
Section {
|
||||
EditRoomAddressListRow(aliasLocalPart: aliasBinding,
|
||||
serverName: context.viewState.serverName,
|
||||
errorDescription: context.viewState.aliasErrors.errorDescription,
|
||||
footerText: L10n.screenCreateRoomRoomAddressSectionFooter)
|
||||
shouldDisplayError: context.viewState.aliasErrors.errorDescription != nil)
|
||||
.focused($focus, equals: .alias)
|
||||
.id(Focus.alias)
|
||||
} header: {
|
||||
|
||||
@@ -16,9 +16,7 @@ struct EditRoomAddressScreen: View {
|
||||
Form {
|
||||
Section {
|
||||
EditRoomAddressListRow(aliasLocalPart: $context.desiredAliasLocalPart,
|
||||
serverName: context.viewState.serverName,
|
||||
errorDescription: context.viewState.aliasErrors.errorDescription,
|
||||
footerText: L10n.screenEditRoomAddressRoomAddressSectionFooter)
|
||||
serverName: context.viewState.serverName, shouldDisplayError: context.viewState.aliasErrors.errorDescription != nil)
|
||||
.onChange(of: context.desiredAliasLocalPart) { _, newAliasLocalPart in
|
||||
context.desiredAliasLocalPart = newAliasLocalPart.lowercased()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user